主题:这样做一下看一看行不行呀?
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('select * from a_doc where bh=‘+quotedstr(Edtbh.Text);
ADOQuery2.Open;
if ADOQuery2.RecordCount>0 then
begin
application.MessageBox('编号重复!','提示信息',mb_ok+mb_iconinformation);
Edtbh.SetFocus;
exit;
end;
Str_S:='Insert into a_doc (bh,mc)values('+quotedstr(Edtbh.Text)+'quotedstr(Edtmc.Text)+')';
ADOQuery2.Close;// 出错
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add(Str_S);
ADOQuery2.ExecSQL;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('select * from a_doc where bh=‘+quotedstr(Edtbh.Text);
ADOQuery2.Open;
if ADOQuery2.RecordCount>0 then
begin
application.MessageBox('编号重复!','提示信息',mb_ok+mb_iconinformation);
Edtbh.SetFocus;
exit;
end;
Str_S:='Insert into a_doc (bh,mc)values('+quotedstr(Edtbh.Text)+'quotedstr(Edtmc.Text)+')';
ADOQuery2.Close;// 出错
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add(Str_S);
ADOQuery2.ExecSQL;