Delphi6的ClientDataSet的Bug?(50分)

  • 主题发起人 主题发起人 patrickpullman
  • 开始时间 开始时间
P

patrickpullman

Unregistered / Unconfirmed
GUEST, unregistred user!
使用ClientDataSet的AppendData方法,并不修改ClientDataSet的Delta,
而使用Append却修改Delta。
程序如下
//cdsCredit.AppendData(cdsLocal.Data, False);
cdsLocal.First;
while not cdsLocal.EOFdo
begin
cdsCredit.Append;
for I := 0 to cdsLocal.FieldCount - 1do
cdsCredit.Fields := cdsLocal.Fields;
cdsLocal.Next;
end;
因为没有Delta,所以提交到中间层的时候不管Client修改了多少数据,都
不会提交到数据库上去。没办法只能一个一个Append。极端ft中。
各位看看这是怎么回事啊?
 
怎么没人回复啊
 
请看帮助:
VCL Reference
TCustomClientDataSet.AppendData
TCustomClientDataSet See also
Adds a newly fetched packet of records to those already stored in the
client dataset.
procedure AppendData(const Data: OleVariant;
HitEOF: Boolean);
Description
Use AppendData to add a newly fetched packet of records from a provider
to the client dataset. Data indicates the packet of records to add.
HitEOF indicates whether the provider encountered the end of the dataset
when it fetched the records from the database server.
Most applications call GetNextPacket instead to fetch a packet of records
and automatically add them to those already available. Use AppendData
when fetching data packets directly from the provider rather than letting
the client dataset fetch data.
可见,AppendData是用来给用户手工下拉数据并添加到CDS中的。
 
帮助我也看了,可是要实现从一个ClientDataSet到另外一个ClientDataSet的批量数据移动
要是一个一个的Append总不太方便,应该使用什么方法?
 
摘自Delphi 5's help
Adds a newly fetched packet of records to those already stored
in the client dataset.
procedure AppendData(const Data: OleVariant;
HitEOF: Boolean);
Description
Use AppendData to add a newly fetched packet of records from
the server application to the client dataset. Data indicates
the packet of records to add. HitEOF indicates whether or not
the application server encountered the end of the dataset when
it fetched the records from the database server.
Most applications call GetNextPacket instead to fetch a packet of
records and automatically add them to those already available.
Use AppendData when fetching data packets directly from the
application server rather than letting the client dataset fetch data.
基本上, 用AppendData来取Server上的数据, 不妨把cdsLocal.Data看作Server.
与其用AppendData类比Append, 还不如用AppendData类比GetNextPacket.
所以, AppendData不会更改Delta.
我还没有查Delphi6's help.应该是一样的.
 
一个一个的Append,不太方便,但也不很麻烦。起初一想觉得很不爽,但仔细一想,
这其实已经是最简单的办法。我是想不到其它更好的办法了。如果让我来写一个这样
的"AppendData"过程,我还是会一个一个的Append。
 
接受了吧
 
后退
顶部