Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Problems with MOD-Function by accessing MS-Access Database via SQL in Delphi
Hello,
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 :=3D 'SELECT * FROM database1 WHERE
value1=3D1 AND value2=3D ' + inttostr(array[3]);


ADOQuery1.Open;


Label5. Caption:=3DADOQuery1
. Fiel=ADdByName('valu
e4').AsString;


Now I only want to select these rows, where the Integer value3 ends on
1=2E   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 :=3D 'SELECT * FROM database1 WHERE
value1=3D1 AND value2=3D ' + inttostr(array[3])+' AND MOD(value3,10) =3D
 1;


Delphi shows me a Syntax Error in this statement.

Thx for help!


Report this thread to moderator Post Follow-up to this message
Old Post
sarah18web
08-24-05 01:24 AM


Re: Problems with MOD-Function by accessing MS-Access Database via SQL in Delphi
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.


Report this thread to moderator Post Follow-up to this message
Old Post
sarah18web
08-24-05 01:24 AM


Re: Problems with MOD-Function by accessing MS-Access Database via SQL in Delphi
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.

Report this thread to moderator Post Follow-up to this message
Old Post
Ross Presser
08-24-05 01:24 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 11:26 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006