Page 1 of 1
TMemDataSet
Posted: Wed 22 May 2013 21:35
by thebert
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
Re: TMemDataSet
Posted: Thu 23 May 2013 11:25
by DemetrionQ
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.
Re: TMemDataSet
Posted: Thu 23 May 2013 13:04
by thebert
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."
Re: TMemDataSet
Posted: Thu 23 May 2013 13:25
by DemetrionQ
TMemDataSet is an inner class of UniDAC, you shouldn't create and use it directly.
Re: TMemDataSet
Posted: Fri 24 May 2013 02:40
by thebert
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.
Re: TMemDataSet
Posted: Mon 27 May 2013 16:14
by DemetrionQ
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.