缓存更新问题! 找免费管家婆软件
属性设为 true,RequestLive(更新)属性也设为true,在dbgrid中更新后直接
调用ApplyUpdates,代码如下:
try
dmCommon.DBCommon.StartTransaction;
with Qry do
begin
ApplyUpdates;
dmCommon.DBCommon.Commit;
end;
msgdlg(''保存成功'',mdtInformation,mdbok);
except
on e:exception do
begin
dmCommon.DBCommon.Rollback;
msgdlg(''保存失败''+E.Message,mdtError,mdbok);
abort;
end;
end;
但是在作数据修改时,第一次可以成功修改多个记录,但是保存后再次修改
其他多条记录时总是不成功或是不能全部成功,不知什么原因!
2楼: 事务运用错误
Try
提交
ExcepT
报错,回滚,并退出;
dmCommon.DBCommon.Commit;放在最后 如免费管家婆软件
3楼: dmCommon.DBCommon.Commit;放在最后还是一样,问题依旧!
4楼: 没碰过
5楼: ExcepT
报错,回滚,并退出!!!
6楼: with Qry do
begin
dmCommon.DBCommon.StartTransaction;
try
ApplyUpdates;
dmCommon.DBCommon.Commit;
msgdlg(''保存成功'',mdtInformation,mdbok);
except
on e:exception do
begin
dmCommon.DBCommon.Rollback;
msgdlg(''保存失败''+E.Message,mdtError,mdbok);
abort;
end;
end;
CommitUpdates;
end;
已经改成和DELPHI帮助里一样了,还是一样的问题!
仓库管理软件版7楼: dmCommon.DBCommon.Commit;放在最后
8楼: 拜托我试了好几次了,不是什么放在最后的问题!下面是DELPHI帮助里的例子,不会有什么问题,不要在这里纠缠了好不?
procedure TForm1.ApplyButtonClick(Sender: TObject)
begin
with CustomerQuery do
begin
Database1.StartTransaction;
try
ApplyUpdates; {try to write the updates to the database};
Database1.Commit; {on success, commit the changes};
except
Database1.Rollback; {on failure, undo the changes};
raise; {raise the exception to prevent a call to CommitUpdates!}
end;
CommitUpdates; {on success, clear the cache}
end;
end;
9楼: 可能的问题:
1:主从表同时保存,GBGRID中的数据为从表数据;
2:在GBGRID使用了PICKLIST;
3:修改多条数据;
10楼: 在GBGRID里修改多条数据的多个字段时,使用缓存更新是不是不行啊?