Page 1 of 1

DateTime error in 3.4.6?

Posted: Thu 31 Jul 2014 09:07
by glennvisma
Hi. I'm trying to use AsDateTime in your dbExpress driver, but it doesn't seem to be working?

Code: Select all

  qry := TSQLQuery.Create(nil);
  try
    qry.SQLConnection := FSQLConnection;
    qry.SQL.Text := 'CREATE TABLE [TEST] ('
      + '  [DATETIME] datetime NOT NULL '
      + ', [NUMBER] integer NOT NULL '
      + ', [TEXT] nvarchar(30) NULL '
      + '); ';
    qry.ExecSQL;
    qry.Close;

    qry.SQL.Text := ' CREATE UNIQUE INDEX [PK_TEST] ON [TEST]([DATETIME], [NUMBER]); ';
    qry.ExecSQL;
    qry.Close;

    qry.SQL.Text := 'INSERT INTO [TEST] ([DATETIME], [NUMBER], [TEXT]) '
      + ' VALUES (:DATETIME, :NUMBER, :TEXT);';
    qry.Params[0].AsDateTime := Now;
    qry.Params[1].AsInteger := 1;
    qry.Params[2].AsString := 'Text';
    qry.ExecSQL;
    qry.Close;

  finally
    qry.Free;
  end;
When I run this code I get the error: No value for parameter 'DATETIME'

Re: DateTime error in 3.4.6?

Posted: Fri 01 Aug 2014 12:36
by PavloP
Please try to compose a small sample to demonstrate the problem and send it to me at email pavelp*devart*com. Also specify the exact version of dbExpress driver for SQLite and Delphi you are using.

Re: DateTime error in 3.4.6?

Posted: Fri 01 Aug 2014 13:51
by glennvisma
Ok. I have sent you the code now.

Re: DateTime error in 3.4.6?

Posted: Tue 05 Aug 2014 09:28
by PavloP
1. Unfortunately, we still can't reproduce the problem with DateTime.

2. The reason for exception occurrence in the query called via TSQLQuery in a bundle with TClientDataset is not related to our driver. This is a DataSnap error, it occurs in the TCustomSQLDataSet.PSGetDefaultOrder method on an attempt to define the ordering of the query result (parsing of the CASE construct). This problem can be solved by setting the poRetainServerOrder option of TDataSetProvider. This should be done before using the provider. In your case, it will look like the following:

Code: Select all

  prov.Options := prov.Options + [poRetainServerOrder];
  cds.SetProvider(prov);
3. The reason for exception occurrence in the query called via TSimpleDataSet is the same as the one describe above one, but it can't be resolved in the described way, since there is no access to the internal TDataSetProvider. This is due to the fact that TSimpleDataSet is designed for simple queries: http://docwiki.embarcadero.com/RADStudi ... pleDataSet

Re: DateTime error in 3.4.6?

Posted: Wed 06 Aug 2014 12:07
by glennvisma
Hm... Ok