How to disable automatic sorting by primary key in Delphi application that use Microsoft SQL Server database

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
unused_username
Posts: 1
Joined: Mon 28 May 2018 19:49

How to disable automatic sorting by primary key in Delphi application that use Microsoft SQL Server database

Post by unused_username » Thu 31 May 2018 12:52

I have a Delphi application in which, on edit record data, the record is sorted automatically by primary key. I want that record, after it is edited, remains in the same position. How to do that?

Note that I want this to be done in application, not just in SQL Server database, because then, every time the application is on some computer, there should be changes to SQL SERVER database through management studio.

wilton_radinfo
Posts: 11
Joined: Mon 29 Apr 2013 18:59

Re: How to disable automatic sorting by primary key in Delphi application that use Microsoft SQL Server database

Post by wilton_radinfo » Fri 01 Jun 2018 12:49

you should be passing some value to the indexfieldnames property,

another detail and that it is not common for an application to allow the user to change values ​​from the primary key of the table, it would be good to prevent this.

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: How to disable automatic sorting by primary key in Delphi application that use Microsoft SQL Server database

Post by Stellar » Tue 05 Jun 2018 08:47

If no index was set for TMSTable/TMSQuery, then after changing, the record in the client DataSet will remain in the same position. If, after changing the record, you will update the Dataset data, for example by calling the Refresh method, then the server can return data where the changed record may take a different position. Unfortunately, we cannot influence the server behavior, you can read more information about this behavior in MS SQL Server documentation.

Post Reply