Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Order by on ClientDataSet doesn't work

I have a problem with TClientDataSet. On the DataSet, the order by clause of my SQL works fine, but when I use a TClientDataSet, the records appear in order of the database's id field.

What am I doing wrong?

like image 686
vusud Avatar asked Mar 30 '18 00:03

vusud


1 Answers

Your problem is in the TDataSetProvider, not in the TClientDataSet itself.

Try setting the poRetainServerOrder flag to True in the TDataSetProvider.Options property:

Signals that the client should not attempt to re-establish the default order by sorting the records in the data packet. This prevents the client from changing the record order because, for example, it is unable to duplicate the locale on the server.

like image 179
MathOliveira Avatar answered Nov 27 '22 04:11

MathOliveira