Delphi .NET (2) Database (71) Delphi IDE (89) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
TClientDataSet: Temporary vs. permanent indices
2 comments. Current rating: (2 votes). Leave comments and/ or rate it.
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
Begin
Close;
FieldDefs.Clear;
FieldDefs.Add ('Project', ftInteger, 0, True);
FieldDefs.Add ('Number', ftInteger, 0, False);
IndexDefs.Clear;
IndexDefs.Add ('IProject', 'Project', [ixPrimary, ixUnique]);
CreateDataSet;
Open;
AddIndex('TempIndex', 'Number;Project', [ixPrimary, ixUnique]);
End { with ClientDataSet1 }
| |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
|
anonymous from United States
|
 |
|
|
|
|
anonymous from United States
|
 |
|
|
|
|