문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top