the following problem:
I use Delphi 6 to access a MS Access Database.
In short, the Delphi Code looks like this:
ADOConnection1.Open;
ADOQuery1.Close;
ADOQuery1.SQL.Text := 'SELECT * FROM database1 WHERE
value1=1 AND value2= ' + inttostr(array[3]);
ADOQuery1.Open;
Label5.Caption:=ADOQuery1.Fiel*dByName('value4').A sString;
Now I only want to select these rows, where the Integer value3 ends on
1. So I need the Modulo-Function. I found in the Internet these two
functions:
MOD(x,y) und x % y
But I get an error if I want to use one.
For example, If I change
ADOQuery1.SQL.Text := 'SELECT * FROM database1 WHERE
value1=1 AND value2= ' + inttostr(array[3])+' AND MOD(value3,10) = 1;
Delphi shows me a Syntax Error in this statement.
Thx for help!Sorry, there is a ' missing in the code. But it has nothin to do with
the problem:
The first code runs perfectly, but If I insert
AND MOD(20,10) = 0 there is the syntax error again.|||On 23 Aug 2005 11:51:15 -0700, sarah18web wrote:
> Sorry, there is a ' missing in the code. But it has nothin to do with
> the problem:
> The first code runs perfectly, but If I insert
> AND MOD(20,10) = 0 there is the syntax error again.
Don't know what it might have to do with Delphi; but MOD() is not a
function supported by SQL server. Only the % operator works.
No comments:
Post a Comment