Page 1 of 1

Error using parameters - ftTimeStamp

Posted: Fri 13 Dec 2013 10:24
by Bjarke_Moholt
I have a field in a database of the type TimeStamp. I am trying to access this field using parameters like this:

Code: Select all

var
  QIbc  : TIBCQuery;
  Param : TParam;    
begin
  QIBC := TIBCQuery.Create(nil);
  QIbc.FetchAll := True;
    QIBC.UniDirectional := False;
    try
      QIbc.Connection := Self.IBCConnection;
      QIbc.SQL.Add('Select * from MODELQUERY543875505 ');
      QIbc.SQL.Add('where timestamp = :testParam');

      Param := QIbc.FindParam('testParam');
      if Assigned(Param) then begin
        Param.DataType := ftTimeStamp;
        Param.Value := now;
      end;

      QIbc.Open;

When I do this I get an assertionFailed exception with this message: 'Unknown data type'

I have tried with other time formats; ftDate, ftTime, ftDateTime. These yield an SQL error:
Dynamic SQL Error
SQL error code =-104
Token unknown - line 2, column 17
='.

With the following SQL:

Code: Select all

Select * from MODELQUERY543875505 '#$D#$A'where timestamp = ?

I am running IBDAC 5.1.4. for RAD studio XE.

So, How do I use the timestamp format in the IBCQuery?
Bjarke_Moholt

Posts: 13
Joined: Thu 21 Nov 2013 13:51

Re: Error using parameters - ftTimeStamp

Posted: Fri 13 Dec 2013 14:23
by AndreyZ
Thank you for the information. We have reproduced this problem. We will fix this problem in the next IBDAC build.