TClientDataSet.ApplyUpdates()的问题(80分)

  • 主题发起人 主题发起人 bjaman
  • 开始时间 开始时间
B

bjaman

Unregistered / Unconfirmed
GUEST, unregistred user!
使用TClientDataSet作为内存表使用,在提交数据时这样用:
if (ClientDataSet1.ChangeCount > 0) then
ClientDataSet1.ApplyUpdates(-1);
然而出错了:
进程名 raise Exception class EDatabaseError with Message 'Record not found or Changed by another user',Process stopped,use Stop or Run to continue.

在线帮助中这样说:
Warning: The provider can't detect when an update conflicts with another user's changes to a memo field. The server will not detect and return these conflicts as errors.
而我频频出错的那行语句所指向的内存表中,恰恰有字段为Memo型.
事实上,我调试程序时是单机运行,且不曾手工打开过数据库.不存在其他用户改变了记录的情况.那么为什么还有上述错误出现呢? 又该如何解决呢?
 
你没用Post就用ApplyUpdates了?
ClientDataSet1.Post; //提交更改
ClientDataSet1.ApplyUpdates(0); //上传更改到服务器.
 
to zqw0117:
该句前面有post操作如下:
if ClientDataSet1.State in [dsInsert,dsEdit] then
ClientDataSet1.Post;
另外,我ApplyUpdates(0)也试过,有同样的问题
 
我的意思是说,如果要提交的数据里有备注型字段, 使用批量提交ApplyUpdates()就会出错呢? 可是我的备注型字段是必不可少的,如何解决呢?
 
设置provider的updatemode
 
谢谢郭大侠!
把provider的UpdateMode设为upWhereChanged,问题果然解决!原来玄机在这里...晕...
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
467
import
I
I
回复
0
查看
994
import
I
I
回复
0
查看
3K
import
I
后退
顶部