DateTime error in 3.4.6?

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQLite in Delphi and C++Builder
Post Reply
glennvisma
Posts: 4
Joined: Wed 06 Mar 2013 14:55

DateTime error in 3.4.6?

Post by glennvisma » Thu 31 Jul 2014 09:07

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'

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: DateTime error in 3.4.6?

Post by PavloP » Fri 01 Aug 2014 12:36

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.

glennvisma
Posts: 4
Joined: Wed 06 Mar 2013 14:55

Re: DateTime error in 3.4.6?

Post by glennvisma » Fri 01 Aug 2014 13:51

Ok. I have sent you the code now.

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: DateTime error in 3.4.6?

Post by PavloP » Tue 05 Aug 2014 09:28

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

glennvisma
Posts: 4
Joined: Wed 06 Mar 2013 14:55

Re: DateTime error in 3.4.6?

Post by glennvisma » Wed 06 Aug 2014 12:07

Hm... Ok

Post Reply