procedure TrklrFram.ado_shmainBeforeDelete(DataSet: TDataSet);
var
i_sql, idstr: string;
i: integer;
begin
inherited;
if ado_shmain.FindField('cSTATE').asstring <> '未提交' then
Abort;
if not myhs.Confirm1('确认要删除吗?') then
Abort;
i_sql := 'select * from tf_sc_sqmx where mid=' + ansiquotedstr(ado_shmain.findfield('id').AsString, '''');
OpenADODataset(maindm.QryPub, i_sql);
if maindm.QryPub.RecordCount > 0 then
begin
with maindm.QryPub do
for i := 1 to maindm.QryPub.RecordCount do
idstr := maindm.QryPub.findfield('mid').AsString;
with maindm.QryPub do
begin
Close;
sql.Clear;
sql.Text := 'DELETE FROM tf_sc_sqmx WHERE mid = ' + ansiquotedstr(idstr, '''');
ExecSQL;
end;
end;
end;
转载于:https://my.oschina.net/u/3328774/blog/1589175