Board index » delphi » Access 7.0 and Delphi 2.0 Query Error

Access 7.0 and Delphi 2.0 Query Error

. I have yet to get Access 7.0 ODBC and Delphi 2.0 to work correctly
for me when I perform a basic query. I should rephrase, when I do a
basic query (select * from customers) I get the correct results, but
if I want to get real fancy and do:

  select * from customers where (active="Y")

I get an ODBC error that states "Too few parameters, expect 1". I
can't figure it out and the Microsoft guys weren't any help. Any
suggestions? Thanks.

jim cook
Visual XS Inc.

 

Re:Access 7.0 and Delphi 2.0 Query Error


Are you sure there is such a field as "active"? Because Jet normally
thinks everything you use where a field should be that it doesn't know is
a parameter. So this message is often a clue to a misspelled field name.

BTW, using Delphi 2.0 and Access 7.0?  Take a look at Opus DirectAccess.
It replaces the BDE with a direct, transparent interface to DAO/Jet. Refer
to <http://www.opus.ch/ODA>.

Peo
Opus Software GmbH

Quote
> JIMC...@VISUALXS.COM (James Cook) wrote in article

<31d2d93a.315454...@client1.news.psi.net>...
Quote
> . I have yet to get Access 7.0 ODBC and Delphi 2.0 to work correctly
> for me when I perform a basic query. I should rephrase, when I do a
> basic query (select * from customers) I get the correct results, but
> if I want to get real fancy and do:

>   select * from customers where (active="Y")

> I get an ODBC error that states "Too few parameters, expect 1". I
> can't figure it out and the Microsoft guys weren't any help. Any
> suggestions? Thanks.

> jim cook
> Visual XS Inc.

Re:Access 7.0 and Delphi 2.0 Query Error


Quote
>> I get an ODBC error that states "Too few parameters, expect 1". I
> So this message is often a clue to a misspelled field name.

No the field is spelled correctly. I can even gerate a fully working
version of this query in Access, copy and paste the SQL into my TQuery
component and get the same error.

jim cook
Visual XS Inc.

Re:Access 7.0 and Delphi 2.0 Query Error


I think I get it now. The problem are the double quotes. The BDE uses
double quotes to surround identifiers, just like Access uses []. So the
BDE converts your SQL to

  Select * from .. where (active = [Y])

You should write

  Select * from .. where (active = 'Y')

Peo
Opus Software GmbH

Quote
> JIMC...@VISUALXS.COM (James Cook) wrote in article

<31d40abc.610...@client1.news.psi.net>...
Quote
> >> I get an ODBC error that states "Too few parameters, expect 1". I

> > So this message is often a clue to a misspelled field name.

> No the field is spelled correctly. I can even gerate a fully working
> version of this query in Access, copy and paste the SQL into my TQuery
> component and get the same error.

> jim cook
> Visual XS Inc.

Other Threads