Solved

editing record moves to the last in TClientDataSet

Posted on 2007-03-24
4
260 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 24

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

15 Experts available now in Live!

Get 1:1 Help Now