popmenu的例子
var
r_id :string;
begin
if Qry.FieldByName('code1').AsString<>'' then
begin
if (Application.MessageBox('确认删除?', '提示', MB_YESNO+mb_iconinformation)=IDYES) then
begin
r_id:=Qry.fieldByName('id').AsString;
del_ado.Connection.BeginTrans;
try
with del_ado do
begin
del_ado.Close;
del_ado.SQL.Clear();
del_ado.SQL.Add('delete from u_qianyue where r_id='''+r_id+'''');
del_ado.ExecSQL;
del_ado.SQL.Clear();
//删除完u_qianyue表中的记录后,更新u_report表中的签约日期和过户日期为空
del_ado.SQL.Add('update u_report set bargain_date = null,register_date = null where id='''+r_id+'''');
del_ado.ExecSQL;
showmessage('删除成功!');
del_ado.Connection.CommitTrans;
btnQueryClick(self);
end;
except
on E: Exception do
begin
del_ado.Connection.RollbackTrans; //如有异常,事务回滚
ShowMessage(E.Message);
end
end;
{ try
del_ado.Connection.BeginTrans;//.begainTrans; //BeginTransComplete
//on Error Goto ErrNum
del_ado.Close;
del_ado.SQL.Clear();
del_ado.SQL.Add('delete from u_qianyue where r_id='''+r_id+'''');
del_ado.ExecSQL;
del_ado.SQL.Clear();
//删除完u_qianyue表中的记录后,更新u_report表中的签约日期和过户日期为空
del_ado.SQL.Add('update u_report set bargain_date = null,register_date = null where id='''+r_id+'''');
del_ado.ExecSQL;
showmessage('删除成功!');
del_ado.Connection.CommitTrans;
btnQueryClick(self);
except
del_ado.Connection.RollBackTrans;
end; }
end;
end;
end;