delphi删除时特别注意

2017-12-16 10:09:40来源:oschina作者:小砍侃人点击

分享

procedure TrklrFram.ado_shmainBeforeDelete(DataSet: TDataSet); vari_sql, idstr: string;i: integer; begininherited;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 thenbegin with maindm.QryPub dofor i := 1 to maindm.QryPub.RecordCount do idstr := maindm.QryPub.findfield('mid').AsString; with maindm.QryPub do beginClose;sql.Clear;sql.Text := 'DELETE FROM tf_sc_sqmx WHERE mid = ' + ansiquotedstr(idstr, '''');ExecSQL; end;end; end;

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台