D2007 and firebird Datatime parameter error

D2007 and firebird Datatime parameter error

Postby Fabioda » Mon 12 Nov 2007 13:58

Hi,
I have a tsqlquery with an insert statement. One of the fields is a timestamp. I use parameters to set field values, and for the timestamp field the statement is:
q.ParamByName('DATE_FIELD').AsDateTime := Now

When I execute the statement with ExecSQL i get a "No value for parameter DATE_FIELD.
It used to work with UIB Dbexpress driver I was using with D2006. Any clue? I even tried using .Value instead of .AsDateTime

TIA,
Fabio Dalle Ave
Fabioda
 
Posts: 4
Joined: Mon 12 Nov 2007 13:52

Postby Fabioda » Mon 12 Nov 2007 14:07

To clarify further: I'm using the latest dbexpress driver 2.00.5.
Right now I got away setting CURRENT_TIMESTAMP directly in the query. But I have another application with the same error (but this time the timestamp is input by the user)..

Fabio Dalle Ave
Fabioda
 
Posts: 4
Joined: Mon 12 Nov 2007 13:52

Postby Plash » Mon 12 Nov 2007 15:05

You should use the following code for Delphi 2007:
Code: Select all
  SQLQuery.ParamByName('DATE_FIELD').DataType := ftTimeStamp;
  SQLQuery.ParamByName('DATE_FIELD').Value := Now;
Plash
Devart Team
 
Posts: 2844
Joined: Wed 10 May 2006 07:09

Postby Fabioda » Mon 12 Nov 2007 15:16

Plash wrote:You should use the following code for Delphi 2007:
Code: Select all
  SQLQuery.ParamByName('DATE_FIELD').DataType := ftTimeStamp;
  SQLQuery.ParamByName('DATE_FIELD').Value := Now;


Thanks.
I tried that but didn't work. Same error.

Fabio
Fabioda
 
Posts: 4
Joined: Mon 12 Nov 2007 13:52

Postby Plash » Mon 12 Nov 2007 15:34

You should use exactly this code. If you set the DataType property to ftTimeStamp but assign a value using the AsDateTime property, the error will occur.
Plash
Devart Team
 
Posts: 2844
Joined: Wed 10 May 2006 07:09

Postby Fabioda » Mon 12 Nov 2007 15:39

Ok thanks...
Indeed I had left .AsDateTime... Changing it to .Value got it to work.

Thanks again.

Fabio
Fabioda
 
Posts: 4
Joined: Mon 12 Nov 2007 13:52


Return to dbExpress driver for InterBase & Firebird