var name:string with adoquey1 do begin close; sql.clear; sql.add('select * from sjblist where name = '''+edit1.text+'''') open; if recordcount>0 then messagedlg('sjb alreday exist',mtinformation,[mbok],0) else begin close; sql.clear; sql.add('insert into sjblist (name) values ('''+edit1.text+''')'); execsql; end; end;
to foxe(火狐) 谢谢。 但你的程序不行,当edit1.text=表中数据时,还是会写到数据库中。请大家继续关注我的问题,分数不够可以再加
with adoquey1 do
begin
close;
sql.clear;
sql.add('select * from sjblist where name = '''+edit1.text+'''')
open;
if recordcount>0 then
messagedlg('sjb alreday exist',mtinformation,[mbok],0)
else
begin
close;
sql.clear;
sql.add('insert into sjblist (name) values ('''+edit1.text+''')');
execsql;
end;
end;
谢谢。
但你的程序不行,当edit1.text=表中数据时,还是会写到数据库中。请大家继续关注我的问题,分数不够可以再加