Click here to Skip to main content
15,893,904 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I am inserting data in a SQL Database Table with columns

SensorID,SensorValue, DateTime

Where SensorID is constant. I need to display database table in a datagridview in a Sorted form with respect to DateTime. Can anyone please tell me the SQL Query for that. Thankyou !
Posted
Comments
CHill60 27-Feb-13 5:05am    
Have you tried anything yet?

1 solution

try this query

Ascending order :
Select * from SensorTableName order by DateTime Asc


Descending order :
Select * from SensorTableName order by DateTime desc

Regards,
Prakash.T
 
Share this answer
 
Comments
ontheline89 27-Feb-13 5:09am    
Thank you for your reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900