Z
zjmg
Unregistered / Unconfirmed
GUEST, unregistred user!
很菜的初级问题:为何将combobox1中选中的字段加入下列语句中报错?
procedure TForm2.Button1Click(Sender: TObject);
begin
Query1.close;
query1.sql.clear;
query1.sql.add('select 编号,性别,身高,出生年月');
query1.sql.add('from"hj.db"');
query1.sql.add('where 性别=combobox1.items[0]');
query1.prepare;
query1.open;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
Query1.close;
query1.sql.clear;
query1.sql.add('select 编号,性别,身高,出生年月');
query1.sql.add('from"hj.db"');
query1.sql.add('where 性别=combobox1.items[0]');
query1.prepare;
query1.open;
end;