Frage

I need some help concerning TClientDataSet since after doing extensive research, I'm still confused about some features.

From what I so far understand, saving the TClientDataSet structure to a file, preserves only the FieldDefs. All other definitions such as filters and indexes are lost. So, I must recreate them after openning the DataSet, in order to that definitions take place.

I infere from this, that, if I want to store those definitions in disk (so they will available to the application as a whole and not only for a specific form), I must maintain a separate DataSet. Then, at runtime, I can recreate all definitions from that DataSet.

My question is: is there any other mechanism to store those definitions, other than the one mentioned above? A TDataSetProvider can do the trick?

I appologize for my ignorance and appreciate any enlightment about the subject.

Thanks in advance.

War es hilfreich?

Lösung

Yes, there are many possibilities to do what you want.

But, TDataSetProvider is not one of them.

It is possible to use:

  • 1 TRegistry
  • 2 TIniFiles
  • 3 Persist it in database (not a good approach)
  • 4 Another DataSet, as you mentioned.

Pick the easier and most realiable for you.
TIniFile is very often used to save definitions in many scenarios.

Andere Tipps

When you save ClientDataSet it saves data structure, data, index definitions, parameters, delta-data etc. It saves only one filter definition though.

You can also save indesies and filters in Delphi code.

As mentioned Registry and IniFiles are possibilities too.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top