ADOQuery1.CommandText :='select Content from yourtable where dept_id = 2'; ADOQuery1.CommandType := adCommandText; ADORecordSet1 := ADOQuery.Execute while not ADORecordSet1.Eof do begin ComboBox2.Items.Add(ADORecordSet1.Fields['Content'].Value); ADORecordSet1.MoveNext;end大致是这么写
query1.close; query1.sql.clear; query1.sql.add('select * from table1 where dept_id=2'); query1.open; query1.first; combobox1.items.clear; while not query1.eof do begin combobox1.items.add(query1.fieldbyname('Content').asstring); end;
对不起,循环里加句query1.next; query1.close; query1.sql.clear; query1.sql.add('select * from table1 where dept_id=2'); query1.open; query1.first; combobox1.items.clear; while not query1.eof do begin combobox1.items.add(query1.fieldbyname('Content').asstring); query1.next; end;
ADOQuery1.CommandText :='select Content from yourtable where dept_id = 2'; ADOQuery1.CommandType := adCommandText; ADORecordSet1 := ADOQuery.Execute while not ADORecordSet1.Eof do begin ComboBox2.Items.Add(ADORecordSet1.Fields['Content'].Value); ADORecordSet1.MoveNext;
ADOQuery1.CommandType := adCommandText;
ADORecordSet1 := ADOQuery.Execute
while not ADORecordSet1.Eof do
begin
ComboBox2.Items.Add(ADORecordSet1.Fields['Content'].Value);
ADORecordSet1.MoveNext;end大致是这么写
query1.sql.clear;
query1.sql.add('select * from table1 where dept_id=2');
query1.open;
query1.first;
combobox1.items.clear;
while not query1.eof do
begin
combobox1.items.add(query1.fieldbyname('Content').asstring);
end;
query1.close;
query1.sql.clear;
query1.sql.add('select * from table1 where dept_id=2');
query1.open;
query1.first;
combobox1.items.clear;
while not query1.eof do
begin
combobox1.items.add(query1.fieldbyname('Content').asstring);
query1.next;
end;
你是sql不会写还是程序不会写。
ADOQuery1.CommandType := adCommandText;
ADORecordSet1 := ADOQuery.Execute
while not ADORecordSet1.Eof do
begin
ComboBox2.Items.Add(ADORecordSet1.Fields['Content'].Value);
ADORecordSet1.MoveNext;