ClientDataSet 上的排序方式不起作用

Order by on ClientDataSet doesn't work

我对 TClientDataSet 有疑问。在 DataSet 上,我的 SQL 的 order by 子句工作正常,但是当我使用 TClientDataSet 时,记录按数据库的 id 字段的顺序出现.

我做错了什么?

您的问题出在 TDataSetProvider, not in the TClientDataSet 本身。

尝试设置 poRetainServerOrder flag to True in the TDataSetProvider.Options 属性:

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.