Since Embarcadero's NNTP server stopped responding from yesterday, I decided I could ask here: I am working on a network that does not support DB, and I need to scroll through the data set to extract the number of columns, their name, row number and values of each field in each line.
I know how to read the values for all the fields in each row, but I don't know how to retrieve the information associated with the column. Does anyone have a handy code?
procedure TForm1.FormCreate(Sender: TObject);
var
index : Integer;
begin
With ASQLite3DB1 do begin
DefaultDir := ExtractFileDir(Application.ExeName);
Database := 'test.sqlite';
CharacterEncoding := 'STANDARD';
Open;
end;
With ASQLite3Query1 do begin
ASQLite3Query1.Connection := ASQLite3DB1;
SQL.Text := 'CREATE TABLE IF NOT EXISTS mytable (id INTEGER PRIMARY KEY, label VARCHAR)';
ExecSQL;
SQL.Text := 'INSERT INTO mytable (label) VALUES ("dummy label")';
ExecSQL;
SQL.Text := 'SELECT id AS Identification, label AS Label FROM mytable';
Open;
//How to get column numbers + names to initialized grid object?
for index := 0 to ASQLite3Query1. - 1 do begin
end;
for index := 0 to FieldCount - 1 do begin
ShowMessage(Fields[index].AsString);
end;
end;
end;
Thanks.
source
share