1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| procedure TForm1.Button2Click(Sender: TObject);
var i : integer;
begin
UIBQuery.SQL.Clear;
UIBQuery.SQL.Add('SELECT * FROM BASE;');
UIBQuery.Execute;
for i := 0 to UIBQuery.Fields.FieldCount - 1 do
begin
if(not isnumeric(UIBQuery.Fields.SqlName[i])) then
treefields.Items.add(nil, UIBQuery.Fields.SqlName[i]);
end;
UIBQUERY.close();
for i := 0 to treeFields.Items.Count - 1 do
begin
//showmessage(inttostr(i) + ' ' + inttostr(treeFields.Items.Count));
UIBQuery.SQL.Clear;
UIBQuery.SQL.Text := 'SELECT DISTINCT ' + treeFields.Items[i].Text + ' FROM BASE;';
UIBQuery.Open;
UIBQuery.First;
while not UIBQuery.EOF do
begin
treefields.Items.AddChild(treeFields.Items[i],UIBQuery.Fields.AsString[0]);
UIBQuery.Next;
end;
UIBQuery.Close();
end;
end; |
Partager