if dsbgzrw.DataSet.FieldByName('rwmc').AsString = ii then
dsbgzrw.DataSet.Open;
dsbgzrw.DataSet.Edit;
dsbgzrw.DataSet.Delete;
dsbgzrw.DataSet.ApplyUpdates;
dsblct.DataSet.ApplyUpdates;
你的需求是,应该根据去dsbgzrw 数据集中找到'rwmc' 这个字段等于ii 的记录,如果找到,那么删除,如果没有,那么不做动作,而你的代码又是啥
if dsbgzrw.DataSet.FieldByName('rwmc').AsString = ii then //这是判断 dsbgzrw 这个数据集的rwmc 的值是否为II,
dsbgzrw.DataSet.Open; 如果是打开数据集
dsbgzrw.DataSet.Edit; 编辑这个数据集
dsbgzrw.DataSet.Delete; 删除当前光标所在记录
dsbgzrw.DataSet.ApplyUpdates; 提交dsbgzrw数据
dsblct.DataSet.ApplyUpdates; 提交dsblct数据
这当然不对了,
if dsbgzrw.DataSet.Locate('rwmc',ii,[]) = true then
begin
dsbgzrw.DataSet.Edit;
dsbgzrw.DataSet.Delete;
dsbgzrw.DataSet.ApplyUpdates;
end;
dsblct.DataSet.ApplyUpdates;