odbc error

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
edvanrijn
Posts: 2
Joined: Thu 12 Aug 2010 14:19

odbc error

Post by edvanrijn » Thu 12 Aug 2010 14:37

i am trying out UNIDAC for delphi 2010 and converteda part of program written in delphi 7 with the BDE components, it usses a microsoft access database.

I get an error from the microsoft odbc driver when i execute the following sql statement :

'SELECT ID, Achternaam, VoorNaam, PostCode, Adres, Plaats, Sexe, Active FROM Klant_naw where Achternaam like "a*" and Active = True order by Achternaam'

The error is : not enough parameters, 1 expected...

if i leave out the part 'where Achternaam like "a*"' i get all records so the connection to the database is ok

I must be doing something wrong with the 'like "a*" part but i tried the % sign as wildcard and that didn't help

I also tried the sql statement in microsoft access and there it is working .

Can someone tell me what i am doing wrong ??

Thanks in advance
Ed

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Fri 13 Aug 2010 13:32

Hello

Please try the following query (single quote instead of double and '%' instead of '*'):

Code: Select all

  SELECT ID, Achternaam, VoorNaam, PostCode, Adres, Plaats, Sexe, Active FROM Klant_naw where Achternaam like 'a%' and Active = True order by Achternaam
This behavior is defined in the Microsoft ODBC driver that is used to connect to MS Access database and we cannot change this behavior. So, you should modify LIKE conditions in your queries.

edvanrijn
Posts: 2
Joined: Thu 12 Aug 2010 14:19

thanks

Post by edvanrijn » Mon 16 Aug 2010 12:58

Bork,

Thanks for your help, it now works well.

regards,

Ed

Post Reply