I am developing ASP.net 2.0 website with SQL Server as database and C# 2005 as the programming language.
In one of my tables, I have a filed named RTime of char datatype to store times. The values of this particular field are like 09:00 AM, 09:15 AM, 09:30 AM, ------ 11:45 AM, 12:00 PM, 12:15 PM, ---- 12:45 PM, 01:00 PM, 01:15 PM, ---- 08:00 PM.
I had thought that, if I use order by RTime in my select statement, the records will be sorted in above order. But I am getting the records in the format 01:00 PM, 01:15 PM, -----08:00 PM, 09:00 AM, 09:15 AM, --- 12:45 AM. My logic was that the records will be sorted using the whole value, and since A(M) comes before P(M), I will get the proper output.
How can I handle the above problem?
Lalit Kumar Barik
India