formshow :
把那两个先付到临时变量, 下面是code
code:=edit1.text
存盘时判断
adoset:=tadoquery.create(self);
adoset.connection:=dataaccess_f.Adcon;
try
try
with adoset do
begin
close;
sql.Clear;
sql.add('select count(*) from ten where code=:code');
// Parameters.ParamByName('name').Value:=trim(edtname.Text);
parameters.ParamByName('code').Value:=trim(edtcode.Text);
open;
ncount:=Fields[0].AsInteger;
end;
except
modalresult:=mrnone;
exit;
end;
finally
freeandnil(adoset);
end;
if (ncount>0)and(trim(edtcode.Text)<>code) then
begin
if application.MessageBox('&raquo;·&frac34;&sup3;&acute;ú&Acirc;&euml;&Ouml;&Oslash;&cedil;&acute;,&Ccedil;&euml;&ETH;&THORN;&cedil;&Auml;&pound;&iexcl;', 'FMECA',mb_ok + MB_ICONWARNING)= idok then
begin
modalresult:=mrnone;
exit;
end;
end else
begin
savedata;
modalresult:=mrok;
end;