我有一个ADOQuery,现在我有下面的代码
query.SQL.Text:='select * from table';
open;
,table表中有很多组数值,其中有字段为‘name’的,我现在open后就返回了一个数据集了,然后
if recordcount<>0 then
begin
for i:=0 to recordcount-1 do
begin
combobox.items.add(FieldByName('name').asString);
end
end
这样会在combobox中出现一组相同的值,我想在combobox中显示open后返回数据集中的所有值应该怎么做啊!
query.SQL.Text:='select * from table';
open;
,table表中有很多组数值,其中有字段为‘name’的,我现在open后就返回了一个数据集了,然后
if recordcount<>0 then
begin
for i:=0 to recordcount-1 do
begin
combobox.items.add(FieldByName('name').asString);
end
end
这样会在combobox中出现一组相同的值,我想在combobox中显示open后返回数据集中的所有值应该怎么做啊!
这个好像也可以了
begin
DW_Combox.Items.Add(query.Recordset.Fields[2].Value);
query.Recordset.MoveNext;
end;
这样就可以了,Field[X]这个x表示你要获取的字段在recordset中的位置,结贴!