Click to See Complete Forum and Search --> : Change in Order of records


kingkedar
July 16th, 2005, 05:14 AM
Hi,

I am executing a query from Vb using ADO / Informix drivers to Informix server.

If I am running the same query on informix console I am getting records in a particular oder but If I am executing the same query from VB then the recordset that I am receving is coming in a seperate order than Informix.

Can anyone tell me how to resolve this problem.

Thanks & Regards,

Kedar

olivthill
July 16th, 2005, 07:45 AM
The order will stay the same if you use the "ORDER BY" clause at the end of your query.

SELECT Thing_ID, Thing_Name, Thing_Date, Thing_etc
FROM Tb_Thing
WHERE Thing_col7 > 'foo'
ORDER BY Thing_date, Thing_Name

You can add the direction of the sort with the ASC and DESC keywords for ascending and descending order,
e.g. SELECT ... ORDER BY Thing_Date DESC, Thing_Name ASC