添加两个checkbutton, CAPTION分别为cno,cna. begin adoquery1.close; adoquery1.sql.clear; if checkbutton1.check then adoquery1.sql.text:='select * form tablename where cno:='''edit1.text''''; else adoquery1.sql.text:='select * from tablename where cna:='''edit1.text''''; adoquery1.open;
不行的话
if adoquery1.active then adoquery1.active:=false;
adoquery1.sql.clear;
adoquery1.sql.add(
insert into 表(学号,姓名,性别,年龄) values ('0','22','男',1) )
adoquery1.execsql
adoquery1.active:=false;
;
严重同意楼上地
adoquery1.sql.clear;
adoquery1.sql.add('insert into tablename(学号,姓名,性别,年龄) values(:a,:b,:c,:d);
adoquery1.parambyname('a').asinteger:=strtoint(edit1.text);
adoquery1.parambyname('b').asstring:=edit2.text;
adoquery1.parambyname('c').asstring:=edit3.text;
adoquery1.parambyname('d').asstring:=edit4.text;
adoquery1.execsql;
adoquery1.sql.clear;
adoquery1.close;
CAPTION分别为cno,cna.
begin
adoquery1.close;
adoquery1.sql.clear;
if checkbutton1.check then
adoquery1.sql.text:='select * form tablename where cno:='''edit1.text'''';
else
adoquery1.sql.text:='select * from tablename where cna:='''edit1.text'''';
adoquery1.open;