TMemDataSet

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
thebert
Posts: 9
Joined: Tue 14 May 2013 16:16

TMemDataSet

Post by thebert » Wed 22 May 2013 21:35

Hello,

I'm trying to use TMemDataSet to replace TClientDataSet. A simple TMemDataSet.Append causes a "cannot perform this operation on a closed dataset.". What am I missing here? I have added the fielddefs and cannot append records?

Terry

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: TMemDataSet

Post by DemetrionQ » Thu 23 May 2013 11:25

Hello.

As an alternative to TClientDataSet, you can use the TVirtualTable component (you can find it at Tool Palette - Data Access section). The detail information about VirtualTable can be found in the UniDAC documentation. You can also see samples of using TVirtualTable in the UniDACDemo\VirtualTable demo.

The Append method can be called only for an open dataset, otherwise you will get the "cannot perform this operation on a closed dataset" error. To open a dataset, the Open method should be called.

thebert
Posts: 9
Joined: Tue 14 May 2013 16:16

Re: TMemDataSet

Post by thebert » Thu 23 May 2013 13:04

Thanks for the insight. A TVirtualTable works as expected. When I call Open on TMemDataSet, I get an error "Assertion failure ...MemDS.pas, line 1115."

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: TMemDataSet

Post by DemetrionQ » Thu 23 May 2013 13:25

TMemDataSet is an inner class of UniDAC, you shouldn't create and use it directly.

thebert
Posts: 9
Joined: Tue 14 May 2013 16:16

Re: TMemDataSet

Post by thebert » Fri 24 May 2013 02:40

I need to track the changes(inserted record, deleted record, modified record) made to the TVirtualTable when using cached updates = true. Is there a property or method I can use todo this? I tried using UpdateRecordTypes and UpdateStatus but they were of no help.

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: TMemDataSet

Post by DemetrionQ » Mon 27 May 2013 16:14

Hello.

You can use the following to track data modifications in TVirtualTable:
1) UpdateStatus method - it returns the update status for the current record in the client dataset.
2) UpdateRecordTypes property - it specifies the records that are visible in a dataset when cached updates are enabled.
3) Data change event handlers, for example OnNewRecord and OnUpdateRecord.
TVirtualTable is inherited from the standard TDataSet class, so you may find the detailed information about these events, property, and method in the TDataSet class documentation.

Post Reply