Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread ORDER BY = Cannot modify a read-only dataset?
Sat, Apr 7 2018 3:14 PMPermanent Link

Hoken

Hi,
I have a simple query in a TEDBQuery. If I try to use "ORDER BY" the query becomes read only! Why is that, and how can I order my dataset and still have it editable?
Sat, Apr 7 2018 4:19 PMPermanent Link

Raul

Team Elevate Team Elevate

On 4/7/2018 3:14 PM, Hoken wrote:
> Hi,
> I have a simple query in a TEDBQuery. If I try to use "ORDER BY" the query becomes read only! Why is that, and how can I order my dataset and still have it editable?
>

You likely need an index for the column(s) in the order by clause.

See manual on how EDB determines whether result is sensitive or not

https://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=Result_Set_Cursor_Sensitivity

Raul
Mon, Apr 9 2018 6:43 AMPermanent Link

Adam Brett

Orixa Systems

Hoken

Rual is 100% correct. However, I would caution a bit against trying to design your application with "Sensitive" queries. It does work perfectly well, but as soon as you really build up a data-model for your applications with more complex data-relationships (JOINs etc.) "Sensitive" queries become impossible.

I always use Read-Only queries, and then have commands within the application to fire SQL INSERT / UPDATE / DELETE statements for the current row the user is editing. This is more robust in my opinion.

Also, as all the queries are Read-Only the process of locking rows in tables is more fully in your control as a programmer, which is also good.

If you are working with Delphi there is a useful TClientDataset component which can help you to create UPDATE statements, also several other good third party components.
Image