• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

editing record moves to the last in TClientDataSet

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
gianluca
Asked:
gianluca
  • 2
1 Solution
 
mokuleCommented:
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
 
gianlucaAuthor Commented:
An index will affect the speed ?? I think it will slow Editing and Appending the records....
0
 
mokuleCommented:
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
 
Tomas Helgi JohannssonCommented:
    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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now