Board index » delphi » MySQL ODBC 3.51 and passing a date as parameter to a query

MySQL ODBC 3.51 and passing a date as parameter to a query

Hi!

I'm working ond Delphi 6 and BDE 5.2 to access a MySQL-Server via
MySQL ODBC 3.51. Whenever I need to set a parameter of type date
to a query (see code below), I get an EDBEngineError "Operation nicht
anwendbar". I tried to trace the cause of this exception and found,
that it is raised by DbiQSetParams() called in SetQueryParams().
DbiQSetParams() returns an error number 10756.
I've set all date formats in the system settings, bde settings and
DATEFORMAT-variable to the correct format (yyyy-mm-dd).
What else can I do to find and solve this problem? Any ideas?

bye,
  Tobias

qry := TQuery.Create(nil);
qry.DatabaseName := 'TEST';
qry.SQL.Add('INSERT INTO test_tbl (my_date) VALUES (:param1)');
qry.Params[0].AsDate := Date;
try
  qry.ExecSQL; //Exception gets raised here
finally
  qry.Free;
end;

 

Re:MySQL ODBC 3.51 and passing a date as parameter to a query


The problem with the query parameters seems to be caused by the
ODBC driver. With the 2.xx instead of the 3.xx MySQL ODBC driver, there
are no problems. But maybe it's a good idea to use Zeos instead of the BDE.

Tobias

Other Threads