| View previous topic :: View next topic |
| Author |
Message |
Hubert Anemaat Guest
|
Posted: Wed Jan 21, 2004 9:55 am Post subject: How adding a secondary index. |
|
|
Hello,
How can I sort on a field by clicking on the title in a DBGrid ?
When using TTable.AddIndex I get an error that TTable is not in exclusive
use.
I cannot set TTable to Exclusive := True because the application is used in
a multi-user environment.
Do I have to create the indexes of all fields when starting the first
application in the network ?
Or is there another solution ?
Hubert Anemaat
|
|
| Back to top |
|
 |
Bill Todd (TeamB) Guest
|
Posted: Wed Jan 21, 2004 2:13 pm Post subject: Re: How adding a secondary index. |
|
|
Indexing every field will hurt performance when you insert or update
records. If you really want to index every field make sure the table
has a primary key then add maintained secondary indexes once at design
time. You will never need to add them again while the system is in
use.
A better solution is to use a TClientDataSet and a TQuery. Let the
user select just the records they wan to work with into the CDS. You
can then sort the records by assigning the field name to the
IndexFieldNames property.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Hubert Anemaat Guest
|
Posted: Thu Jan 22, 2004 11:06 am Post subject: Re: How adding a secondary index. |
|
|
Thanks a lot, Bill.
Hubert
"Bill Todd (TeamB)" <no (AT) no (DOT) com> schreef in bericht
news:o22t00d6jf4325dku17go8ltrncqo9k6v9 (AT) 4ax (DOT) com...
| Quote: | Indexing every field will hurt performance when you insert or update
records. If you really want to index every field make sure the table
has a primary key then add maintained secondary indexes once at design
time. You will never need to add them again while the system is in
use.
A better solution is to use a TClientDataSet and a TQuery. Let the
user select just the records they wan to work with into the CDS. You
can then sort the records by assigning the field name to the
IndexFieldNames property.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
|