假定你要把Table1的F1字段读入DBComboBox1的Items中:
DBComboBox1.Items.Clear;
Table1.Active := True;
Table1.First;
while not Table1.Eof do begin
DBComboBox1.Items.Add(Table1.FieldByName('F1').AsString);
Table1.Next;
end;
改进一下:
DBComboBox1.Items.Clear;
Table1.Active := True;
Table1.disablecontrols;//new
Table1.First;
while not Table1.Eof do begin
DBComboBox1.Items.Add(Table1.FieldByName('F1').AsString);
Table1.Next;
end
Table1.enablecontrols;//new