kbmMWClientQuery.Undo存的坑
在项目中使用了Undo方法,今天被同事发现一个坑,就是Undo后的记录还是被提交了!
kbmMWClientQuery1.Append; kbmMWClientQuery1.FieldByName('fid').AsString:='4'; kbmMWClientQuery1.FieldByName('fname').AsString:='4'; kbmMWClientQuery1.FieldByName('fint').AsInteger:=4; kbmMWClientQuery1.FieldByName('fint64').AsInteger:=4; kbmMWClientQuery1.Post; kbmMWClientQuery1.Undo; kbmMWClientQuery1.AppendRecord(['5','5555',1,1]); kbmMWClientQuery1.Resolve;
看上面的代码,增加一条记录,然后Undo,再增加一条,提交数据,结果是第一次增加的记录,还是被提交了!
大坑!不带这么玩的!!
已经提交到作者的BBS:https://components4developers.blog/forums/topic/issue-of-kbmmwclientquery-undo/