Board index » delphi » Delphi3 and MS Access query (ODBC Ok / Native Driver Error)

Delphi3 and MS Access query (ODBC Ok / Native Driver Error)

Can anyone help me here ?

I can successfully run the following TQuery while using the ODBC driver

  select * from survey where hh_pub = :hh_pub;

and pass the following parameter

  Query1.Close;
  Query1.ParamByName('hh_pub').AsString := '926200401';
  Query1.Open;

However when attempting to use the Native Driver for Access I receive the
following error

General SQL error.
Syntax error in PARAMETER clause.

I am using the latest Delphi 3 Upgrade and BDE 5.0

Thanks in advance

Paul Felstead

 

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


Quote
Paul Felstead wrote:

> Can anyone help me here ?

> I can successfully run the following TQuery while using the ODBC driver

>   select * from survey where hh_pub = :hh_pub;

> and pass the following parameter

>   Query1.Close;
>   Query1.ParamByName('hh_pub').AsString := '926200401';
>   Query1.Open;

> However when attempting to use the Native Driver for Access I receive the
> following error

> General SQL error.
> Syntax error in PARAMETER clause.

> I am using the latest Delphi 3 Upgrade and BDE 5.0

> Thanks in advance

> Paul Felstead

Did you try
params[0].AsString := 'XXXX'

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


Quote
Cynthia Ayotte wrote in message <36127AF5.3...@cgi.ca>...

>Did you try
>params[0].AsString := 'XXXX'

Unfortunately I have and with the same result.
Query1.Params[0].AsString := '926200401';

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


Do you actually have a PARAMETERS section in your query?

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


Yes It is all setup

Name: hh_pub
Data Type: String

I have no problem using this with the ODBC driver

Quote
E.T. wrote in message <361321e5.2647...@forums.inprise.com>...
>Do you actually have a PARAMETERS section in your query?

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


I mean do you have as the first line in your TQuery.SQL
PARAMETERS hh_pub STRING?

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


I mean do you have in the first line of your TQuery.SQL the statement
PARAMETERS hh_pub string?

I think Access needs it.

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


Hi Paul
Are you using Access 7.0 or 97? If you try to open the SQL directly from
the form (click on the Query component and change the property Active to
true) do you get the same error?

--
Fernado Leme
===================================================
Paul Felstead <pa...@symresources.com> escreveu no artigo
<6utne6$r5...@forums.borland.com>...

Quote
> Can anyone help me here ?

> I can successfully run the following TQuery while using the ODBC driver

>   select * from survey where hh_pub = :hh_pub;

> and pass the following parameter

>   Query1.Close;
>   Query1.ParamByName('hh_pub').AsString := '926200401';
>   Query1.Open;

> However when attempting to use the Native Driver for Access I receive the
> following error

> General SQL error.
> Syntax error in PARAMETER clause.

> I am using the latest Delphi 3 Upgrade and BDE 5.0

> Thanks in advance

> Paul Felstead

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


Im using Access 97

I've have tried Activating the Query component by setting to Active (as you
mention), but
the same error occurs.

As I've not seen any other mention to this type of error (I think passing
params to a TQuery is pretty basic stuff)
I wonder if my installation is correct.  I have tried a fresh install on a
2nd PC and I still get the same result.

Quote
Fernando Leme wrote in message <01bdee0f$5a22eb80$273ae1c8@fernando>...
>Hi Paul
>Are you using Access 7.0 or 97? If you try to open the SQL directly from
>the form (click on the Query component and change the property Active to
>true) do you get the same error?

>--
>Fernado Leme
>===================================================
>Paul Felstead <pa...@symresources.com> escreveu no artigo
><6utne6$r5...@forums.borland.com>...
>> Can anyone help me here ?

>> I can successfully run the following TQuery while using the ODBC driver

>>   select * from survey where hh_pub = :hh_pub;

>> and pass the following parameter

>>   Query1.Close;
>>   Query1.ParamByName('hh_pub').AsString := '926200401';
>>   Query1.Open;

>> However when attempting to use the Native Driver for Access I receive the
>> following error

>> General SQL error.
>> Syntax error in PARAMETER clause.

>> I am using the latest Delphi 3 Upgrade and BDE 5.0

>> Thanks in advance

>> Paul Felstead

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


Access 95 does not need it but I believe 97 does.

Woody

Quote
E.T. wrote in message <3613b161.1708...@forums.inprise.com>...
>I mean do you have in the first line of your TQuery.SQL the statement
>PARAMETERS hh_pub string?

>I think Access needs it.

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


I found that you need to set the parameter type to something different
from ftUnknown (TQuery.Params[i].DataType) because ftUnknown is the
default value when the query.sql is parsed and TParam objects
created...

Re:Delphi3 and MS Access query (ODBC Ok / Native Driver Error)


I have not tried this against Access, but with SQL Anywhere you drop the
semicolon from the end of the query statement. Just do:
  SELECT * FROM sometable    <== no ; at end.

That might be your problem. It was a BDE bug as I recall.

Glenn.

Quote
Paul Felstead wrote:
> Can anyone help me here ?

> I can successfully run the following TQuery while using the ODBC driver

>   select * from survey where hh_pub = :hh_pub;

> and pass the following parameter

>   Query1.Close;
>   Query1.ParamByName('hh_pub').AsString := '926200401';
>   Query1.Open;

> However when attempting to use the Native Driver for Access I receive the
> following error

> General SQL error.
> Syntax error in PARAMETER clause.

> I am using the latest Delphi 3 Upgrade and BDE 5.0

> Thanks in advance

> Paul Felstead

Other Threads