Hello.
I want to alphabetically order the rows of a dbgrid. The information is loaded from a 'TDataSource' that takes information from a 'tunitable'.
In 'tunitable' I define the property OrderFiels with alphabetical field name, but the information isn´t ordered in dbgrid.
What am I doing wrong?
Thanks in advance.
DBGrid rows order
Re: DBGrid rows order
Hello,
Please specify the name of the database you are working with. Please also check that the query SELECT * FROM TABLE ORDER BY FIELD (that is generated when setting OrderFiels) return the correct results when using the native database tools.
Please specify the name of the database you are working with. Please also check that the query SELECT * FROM TABLE ORDER BY FIELD (that is generated when setting OrderFiels) return the correct results when using the native database tools.
Re: DBGrid rows order
Hello
I´m working with SQLite version 3.
My select: 'SELECT * FROM TABLE ORDER BY ALPH-FIELD-NAME ASC'
Select return is correct.
Thanks
I´m working with SQLite version 3.
My select: 'SELECT * FROM TABLE ORDER BY ALPH-FIELD-NAME ASC'
Select return is correct.
Thanks
Re: DBGrid rows order
Hello,
We cannot reproduce the problem, please send the DB file to alexp*devart*com
We cannot reproduce the problem, please send the DB file to alexp*devart*com
Re: DBGrid rows order
Hello
I think I've solved with the following correction:
I define property IndexFieldNames with alphabetical field name (I had previously defined another field in this property) and property OrderFiels empty.
In this case the select return is correct (dbgrid rows appears so ordered ascending alphabetical).
Thanks
I think I've solved with the following correction:
I define property IndexFieldNames with alphabetical field name (I had previously defined another field in this property) and property OrderFiels empty.
In this case the select return is correct (dbgrid rows appears so ordered ascending alphabetical).
Thanks
Re: DBGrid rows order
Hello,
This is correct behaviour. As I wrote you before, when enabling the OrderFields property, a corresponding Order By section with specified fields is added to the query - and the query is sent to the server; the server returns a correctly sorted DataSet. However, if the IndexFieldNames is set, the obtained DataSet will be sorted locally by the fields specified in the IndexFieldNames property - and the sorting retrieved from the server will be modified. Therefore simultaneous setting of these two properties won't work correctly.
This is correct behaviour. As I wrote you before, when enabling the OrderFields property, a corresponding Order By section with specified fields is added to the query - and the query is sent to the server; the server returns a correctly sorted DataSet. However, if the IndexFieldNames is set, the obtained DataSet will be sorted locally by the fields specified in the IndexFieldNames property - and the sorting retrieved from the server will be modified. Therefore simultaneous setting of these two properties won't work correctly.