Code: Select all
MSSQL1.SQL.Text := 'SELECT FIELD1, FIELD2, FIELD3, FIELD4 FROM TABLE'
MSSQL1.Open;
while not MSSQL1.Eof do
begin
object := TMyDataObject.Create;
object.rec_field1 := MSSQL1.FieldByName('FIELD1').AsInteger;
object.rec_field2 := MSSQL1.FieldByName('FIELD2').AsString;
object.rec_field3 := MSSQL1.FieldByName('FIELD3').AsString;
object.rec_field4 := MSSQL1.FieldByName('FIELD4').AsString;
List.Add(object);
MSSQL1.Next;
end; //while
The Table holds about 9000 rows. This code runs quite fast and very good for years with Delphi 2007. If i use the same code with Delphi XE3 its 10 times slower than Delphi 2007.
Debugging the problem showed that all "AsString" (also: AsAnsiString) - Statements are much slower than in Delphi 2007. I also tried: Fields[0] and AsVariant / Value.
Select-Statements with only AsInteger for example is quite fast, so: Maybe it has something to do with String / Unicode?
I'm using SDAC Pro 6.6.12 with Delphi XE3 Update 2. Its a Mircrosoft SQL 2005 Standard (Problems are also with: 2008, 2008R2 and 2012)
I would be very thankfull for help.