我的删除代码如下:
procedure TPACT_HOTAL_FORMDOC.SpeedButtonDELETEClick(Sender: TObject);
var
i,num: Integer;
begin
num:=0;
if (DataSetBrokerPACT_HOTAL_DETAL.DataSet.Active) and (not DataSetBrokerPACT_HOTAL_DETAL.DataSet.IsEmpty) then
begin
num:=DataGridPACT_HOTAL_DETAL.SelectedCount;
if num=0 then
begin
JsDialogs.ShowMsg('请先选择要删除的记录','提示');
SysUtils.Abort;
end
else
for i := 0 to num - 1 do
begin
TPACT_HOTAL_SEL_INFO(infobroker.Info).DataSetPACT_HOTAL_DETAL.Bookmark := DataGridPACT_HOTAL_DETAL.SelectedRows;
TPACT_HOTAL_SEL_INFO(infobroker.Info).DataSetPACT_HOTAL_DETAL.Delete;
end;
end
else
begin
JsDialogs.ShowMsg('记录为空','提示');
SysUtils.Abort;
end;
end;