Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
TClientDataSet: Temporary vs. permanent indices Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
25-Aug-02
Category
DB-General
Language
Delphi 2.x
Views
46
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

TClientDataSet: Temporary vs. permanent indices

Answer:

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()):
1   
2   with ClientDataSet1 do
3   begin
4     Close;
5     // Define the fields
6     FieldDefs.Clear;
7     FieldDefs.Add('Project', ftInteger, 0, True);
8     FieldDefs.Add('Number', ftInteger, 0, False);
9     // [..]
10    // Define the PERMANENT index - it is saved with SaveToFile()
11    IndexDefs.Clear;
12    IndexDefs.Add('IProject', 'Project', [ixPrimary, ixUnique]);
13    // Create the dataset
14    CreateDataSet;
15    Open;
16    // the following temporary index is not saved
17    // with data when using SaveToFile()
18    AddIndex('TempIndex', 'Number;Project', [ixPrimary, ixUnique]);
19  end { with ClientDataSet1 }


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC