Migration from TSQLDataSet to TUniQuery I have problem with .First
Posted: Thu 03 Jan 2013 14:08
I began the porting of my Application from DBExpress to UniDac.
If use UniQuery.unidirectional=true for two loop I have a strange problem. The first loop it work but the second loop count 10 - 11 record and exit.
If read ID before loop is non equal in the two times.
If I use identical code with TSQLDataSet don't have problem and loop count is identical on first and second loop.
Result TUniQuery:
First ID 1
First 18285
Second ID 24647
Second 10
Result TSQLDataSet:
First ID 1
First 18285
Second ID 1
Second 18285
If use UniQuery.unidirectional=true for two loop I have a strange problem. The first loop it work but the second loop count 10 - 11 record and exit.
If read ID before loop is non equal in the two times.
If I use identical code with TSQLDataSet don't have problem and loop count is identical on first and second loop.
Code: Select all
var
qr: TUniQuery; //TSQLDataSet;
c: integer;
begin
qr := TUniQuery.Create(nil); // := TSQLDataSet.Create(nil);
qr.UniDirectional := true; // Remove in DBExpress
qr.Connection := UniConnection1; // qr.SQLConnection := SQLConnection1;
qr.SQL.Text := 'select * from CFANAGRA';
qr.Open;
c := 0;
Memo1.Lines.Add('First ID ' + qr.FieldByName('ID').AsString);
while not qr.Eof do
begin
Inc(c);
qr.Next;
end;
Memo1.Lines.Add('First ' + IntToStr(c));
qr.First; // <----- Return on top but not work with UniDac
c := 0;
Memo1.Lines.Add('Second ID ' + qr.FieldByName('ID').AsString);
while not qr.Eof do
begin
Inc(c);
qr.Next;
end;
Memo1.Lines.Add('Second ' + IntToStr(c));
end;First ID 1
First 18285
Second ID 24647
Second 10
Result TSQLDataSet:
First ID 1
First 18285
Second ID 1
Second 18285