lundi 7 juillet 2014

Own TDataSet descendant using an interface as proxy to another dataset


Vote count:

0




I try to use an universal over an interface. This works.


Now I want to create a TDataSet descendant, which gets its data over this interface. Unfortunately I did not manage to hold the current record in sync. So if I attach my TDataSet to a TDataSource and attach this to a TDBGrid, I get only the first entry. If I try to update the current record in GetFieldData, all entries except the first are empty in my grid. If I do not update anything, the first entry is duplicated in all rows.


One problem is, that TDataLink writes directly in a private field (it resides in the same unit) instead of using a method or property. Another problem is, that I cannot overwrite many methods of TDataSet because the developers where so clever not to make them virtual...


For example I tried to set the private field FActiveRecord over a pointer to the property ActiveRecord and update it by UpdateCursorPos. But it crashes in UpdateCursorPos.


When I debug, I see that RecordCount contains the correct value, but FRecordCount is 1.


Unfortunately there is no real documentation regarding creating an own descendant of TDataSet. And all material I found (most links are dead), did not really help me because I cannot use it if I do not directly manage the data.


I created a small project out of the units I already had and boiled it down a bit. You can find it here: http://ift.tt/1rGykQf The FireDAC units can be deleted, you can use whatever TDataSet you like to test. You only have to replace TestTable in FormCreate in: TDatasetGateway.Create(TestTable)


Has someone experience with TDataSet descendants and can help me? Thank you!



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire