Solved

editing record moves to the last in TClientDataSet

Posted on 2007-03-24
4
261 Views
Last Modified: 2013-11-23
Editing a record in a TClientDataSet, causes it to move to the last. It should keep the current position!!!

(* edit recond n.10 *)
 Table3.RecNo:=10;
 Table3.Edit;
 Table3.Fields[1].AsInteger:=Random(100);
 Table3.Post;

(* close and reopen the table *)
 Table3.Close;
 Table3.Open;
(* now the 10th record moved to last!!!! *)
0
Comment
Question by:gianluca
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 500 total points
ID: 18800842
You need to have an index which will force desired order.
Another solution is to replace table with query in which You'll set some sort order.
0
 

Author Comment

by:gianluca
ID: 18806074
An index will affect the speed ?? I think it will slow Editing and Appending the records....
0
 
LVL 17

Expert Comment

by:mokule
ID: 18806168
Generally an index is added for raising speed and maintaining desireed order.
Some slow down while adding is the cost. In most cases it is a fracton of advantages.
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 18974153
    Hi!
Adding an index optimal to a sertain query speeds the retrieval of
the data. Same goes for a table objects.
If space allocations for the index is well designed then adding an insert
will have minimal affects on update and insert to the table.

Regards,
  Tomas Helgi
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can I load a text file into a TVirtualStringTree? 17 105
find a node in VST 2 62
tidtcpserver connection lost handle 2 69
Unique identifier on a terminal server (rdp) 4 45
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now