DelphiFAQ Home Search:
General :: Programming :: Delphi :: Database
Database development with Delphi. Includes issues with BDE, ADO and InterBase.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

TClientDataSet: Temporary vs. permanent indices

On TClientDataSets, that are not connected to a provider but loaded as local text files,
('thin client in brief-case mode'), you cannot use TQuerys.
You may use the .Filter property to select data and use an index to sort.

This sample code shows how to create a temporary index (not saved by SaveToFile())
and how to create a permanent index (saved by SaveToFile()):

With ClientDataSet1 Do
   // Define the fields
   FieldDefs.Add ('Project', ftInteger, 0, True);
   FieldDefs.Add ('Number', ftInteger, 0, False);
   // [..]
   // Define the PERMANENT index - it is saved with SaveToFile()
   IndexDefs.Add ('IProject', 'Project', [ixPrimary, ixUnique]);
   // Create the dataset
   // the following temporary index is not saved
   // with data when using SaveToFile()
   AddIndex('TempIndex', 'Number;Project', [ixPrimary, ixUnique]);
 End { with ClientDataSet1 }
You don't like the formatting? Check out SourceCoder then!
Generated 4:01:03 on Jan 27, 2020