procedure TForm_xjyxx.Button3Click(Sender: TObject);
var
confirm:word;
begin
if dbgrid1.SelectedField.AsString<>''then
begin
confirm:=messagedlg('确实要删除这条记录吗?',mtconfirmation,[mbyes,mbno],0);
if confirm=mryes then
with ADOQuery2 do
begin
{ Close;
sql.Clear;
sql.Add('select copid from data where copid='+quotedstr(dbgrid1.Fields[0].asstring));
open;
if eof=false then
begin
showmessage('清先删除该员工巡更信息!');
exit;
end;
Close;
sql.Clear;
sql.Add('select copid from xgbc where copid='+quotedstr(dbgrid1.Fields[0].asstring));
open;
if eof=false then
begin
showmessage('清先删除巡更班次中该员工的信息!');
exit;
end;
}
Close;
sql.Clear;
sql.Add('delete from cop where copid='+quotedstr(dbgrid1.Fields[0].asstring));
ExecSQL;
end;
with ADOQuery1 do
begin
Close;
sql.clear;
sql.Add('select *from cop');
Open;
end;
showmessage('删除成功!');
end
else
showmessage('请选择需要删除的巡检员!');
end;
这样子还不算重装数据吗