for i:=0 to Query.recordCount-1 do begin combobox1.items.add(Query.fieldByName('datetime').asstring); query.next end;
for i:=0 to Query.recordCount-1 do begin combobox.Items.Add(); next ; end
这写了一个过程 procedure additems_sql(targer_combobox:TCustomComboBox;sql_text:string); var adoqry_temp:tadoquery; begin adoqry_temp:=tadoquery.create(nil); adoqry_temp.Connection :=MainDataModule.adocntMain; adoqry_temp.close; adoqry_temp.SQL.Text:=sql_text; try adoqry_temp.open; except raise; end; adoqry_temp.first; targer_combobox.items.clear; while not adoqry_temp.Eof do begin targer_combobox.Items.add(trim(adoqry_temp.Fields[0].asstring)); adoqry_temp.Next ; end; adoqry_temp.free; end;
ComboBox.Items.Add(Query.Fields[0].AsString);
while not Query1.Eof do begin Combobox1.Items.add(Query.fieldByName('datetime').asstring); Query1.next; end
with query do begin close; sql.clear; sql.add(...); open; first; combobox.clear; while not (query.eof ) do begin combobox.items.add(fieldbyname(..).asstring); next; eind; end;
EdComboBox1.items.Add('your string');
var abc:string; while not query1.eof begin abc:=query1.fieldbyname('fff').asstring; Combobox1.additem(abc,combobox1); query1.next; end;
begin
combobox1.items.add(Query.fieldByName('datetime').asstring);
query.next
end;
begin
combobox.Items.Add();
next ;
end
procedure additems_sql(targer_combobox:TCustomComboBox;sql_text:string);
var
adoqry_temp:tadoquery;
begin
adoqry_temp:=tadoquery.create(nil);
adoqry_temp.Connection :=MainDataModule.adocntMain;
adoqry_temp.close;
adoqry_temp.SQL.Text:=sql_text;
try
adoqry_temp.open;
except
raise;
end;
adoqry_temp.first;
targer_combobox.items.clear;
while not adoqry_temp.Eof do
begin
targer_combobox.Items.add(trim(adoqry_temp.Fields[0].asstring));
adoqry_temp.Next ;
end;
adoqry_temp.free;
end;
begin
Combobox1.Items.add(Query.fieldByName('datetime').asstring);
Query1.next;
end
begin
close;
sql.clear;
sql.add(...);
open;
first;
combobox.clear;
while not (query.eof ) do
begin
combobox.items.add(fieldbyname(..).asstring);
next;
eind;
end;
abc:string;
while not query1.eof
begin
abc:=query1.fieldbyname('fff').asstring;
Combobox1.additem(abc,combobox1);
query1.next;
end;