Hi, All
In my datagridview application there are 3 columns(ID,Date,Time).
Now the records are displayed in ascending order regarding ID.
I want to display the records firstly as ascending order by date, and then as ascending order by Time.
How can i do that, is there any prpoerty of datagridview that can allow me to do that?
Regards,
Vidya
Loading
Nir BarPosted Sep 25, 2009, 9:36 AM
SQL allows secondary sort:
You should do:
"SELECT Appointment.APId, PatientDetails.PId, PatientDetails.Name, Appointment.ADate, Appointment.ATime FROM PatientDetails INNER JOIN Appointment ON PatientDetails.PId = Appointment.PId ORDER BY Appointment.ADate ASC, Appointment.ATime ASC"
Please mark this post as an answer if it helps you
Nir
Vidya YadavPosted Sep 26, 2009, 12:32 AM
That's really worked!!
Regards,
Vidya
Vidya YadavPosted Sep 25, 2009, 8:25 AM
But i don't want the user to manullay click on the datagridview header, it must be seen at the time records get inserted in the datagridview, can it be by any code.
I am inserting the data by using the sql query by using the ORDER BY method, but it only displayes the records as ORDER BY Date or Time and i want both of it.
SQL Query is used is--
"SELECT Appointment.APId, PatientDetails.PId, PatientDetails.Name, Appointment.ADate, Appointment.ATime FROM PatientDetails INNER JOIN Appointment ON PatientDetails.PId = Appointment.PId ORDER BY Appointment.ADate ASC"
Regards,
Vidya
Nagesh RPosted Sep 25, 2009, 8:18 AM