1个回答
展开全部
//这是拼接字串方式
procedure TForm1.Button2Click(Sender: TObject);
begin
adoquery2.sql.Add('select * from D_baoxianxinxi where leixing='''+combobox1.text+''' and baoxiangongsi='''+combobox2.text+'''');
adoquery2.Open;
end;
//这是参数方式
procedure TForm1.Button2Click(Sender: TObject);
begin
adoquery2.sql.Add('select * from D_baoxianxinxi where leixing=:cb1 and baoxiangongsi=:cb2);
adoquery2.Parameters.ParamByName('cb1').Value:=combobox1.Text;
adoquery2.Parameters.ParamByName('cb2').Value:=combobox2.Text;
adoquery2.prepare;
adoquery2.open;
end;
追问
能不能给我截个图啊,我是新手,还有就是query里要怎么写啊?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询