用adoquery取指定字段所有值
while not adoquery1.Eof do
begin
ComboBox1.Items.Add(adoquery1.fieldbyname('id').asstring); //id改为你要指定的字段
adoquery1.Next;
end;
在DBComboBox里显示出来
procedure TForm1.FormCreate(Sender: TObject);
begin
adoquery1.SQL.Add('select * from test);
adoquery1.Open;
DBComboBox1.DataField:='id';
while not adoquery1.Eof do
begin
DBComboBox1.Items.Add(adoquery1.fieldbyname(DBComboBox1.DataField).AsString);
adoquery1.Next;
end;
end;
xxx.sql.text := 'insert into t_log3(name,czsj,czlog)values('''+a +''','''+ b+''','''+c+''')';
或
xxx.sql.text := 'insert into t_log3(name,czsj,czlog)values(:a1,:b1,:c1)';
xxx.parameters.parambyname('a1').values := a;
xxx.parameters.parambyname('b1').values := b;
xxx.parameters.parambyname('c1').values := c;