Trying To copy data from TSQLCLIENTDAtaset to an array
Hi,
I am trying to copy the data from TSQLCLIENTDATASet to an dynamic array
and the print it into a file using string list. Here is the code. In my
report .txt I can see that it has loop through from the index number but
it seems like
NewDynamicArray[i, j] := Fields.Fields[j].asInteger; does not work and
did not copy the actual data into array.
So what to do ? any help ?
Soma
with AMarineSQLClientDataSet do begin
CommandText:= 'Select * From Report';;
if not Active then Open;
First;
NumberOfRecord:= RecordCount;
NumberOfFields:= FieldCount;
SetLength(NewDynamicArray, NumberOfRecord, NumberOfFields);
For i:= 0 to NumberOfRecord -1 do begin
For j:= 0 to NumberOfFields - 1 do begin
NewDynamicArray[i, j] := Fields.Fields[j].asInteger;
new.add(inttoStr( NewDynamicArray[i, j]));
end;
new.SaveToFile('D:\Development\report.txt');
end;
close;
end;
Result:= NewDynamicArray;