Icon View Incident Report

Serious Serious
Reported By: Manuel Alonso Conde Cantero [ETICONSA In
Reported On: 4/13/2015
For: Version 2.18 Build 3
# 4159 Calling TEDBDataSet.Locate Method with TDate Value Causes Conversion Error

When I have a table with one field of type date and indexed by this field, if I do TEdbtable.Locate with a TDate variable value as parameter, I get the following error:

ElevateDB Error #1011 An error occurred with the value 42105 (A conversion error occurred with the value 42105).

Initially, the problem is in the declaration of the dDate variable. If you declare the dDate variable as TDate, an exception is thrown, but if you declare the dDate variable as TDateTime, all is ok.

// I have a form with the following components :
   Db1: TEDBDatabase;
   Tb1: TEDBTable;
   Session1: TEDBSession;
// and this is the FormCreate for the above form :
procedure TForm1.FormCreate(Sender: TObject);
var
 L : TStringList;
 dDate : TDate;
begin
 Session1.SessionName := 'Session1';
 Session1.SessionType := stLocal;
 Session1.LoginUser := 'Administrator';
 Session1.LoginPassword := 'EDBDefault';
 Session1.LocalConfigPath := ExtractFileDir( Application.ExeName );
 edbcomps.Engine.ConfigPath := Session1.LocalConfigPath;
 Session1.Open;
 Db1.Database := 'TEST';
 Db1.DatabaseName := Db1.Database;
 Db1.SessionName := Session1.SessionName;
 Tb1.DatabaseName := Db1.DatabaseName;
 Tb1.TableName := 'TESTDATE';
 Tb1.SessionName := Session1.SessionName;
 L := TStringList.Create;
 try
   Session1.GetDatabases( L );
   if L.IndexOf( Db1.Database ) = -1 then
     Session1.Execute( 'CREATE DATABASE "' + Db1.Database + '"  PATH ' + QuotedStr( Session1.LocalConfigPath ) );
   Db1.Open;
   L.Clear;
   Session1.GetTableNames( Db1.Database, L );
   if L.IndexOf( Tb1.TableName ) = -1 then
   begin
     Db1.Execute( 'CREATE TABLE "' + Tb1.TableName + '" ( "DATEFIELD" DATE )' );
     Db1.Execute( 'CREATE INDEX "iDate" ON "' + Tb1.TableName + '" ("DATEFIELD")' );
   end;
 finally
   L.Free;
 end;
 Tb1.Open;
 Tb1.IndexName := 'iDate';
 dDate := Date;
 // test FindKey
 if not Tb1.FindKey( [ dDate ] ) then
 begin
   Tb1.Append;
   Tb1.FieldByName( 'DATEFIELD' ).Value := dDate;
   Tb1.Post;
 end;
 // test FindKey again
 Tb1.FindKey( [ dDate ] ) ;
 // test Locate -------> THIS WILL RAISE EXCEPTION : ElevateDB Error #1011 An error occurred with the value   
 // 42105 (A conversion error occurred with the value 42105)
 Tb1.Locate( 'DATEFIELD', dDate, [] );
end;



Resolution Resolution
Fixed Problem on 4/20/2015 in version 2.19 build 1


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB LCL Standard with Source
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image