Invalid sorting date colume in .net

  • Hi i am using MS SQL Server 2000 on back end and on front end i am using ASP.NET to show the data while accessing data from table i want to sort date in descending order but it shows below invalid order.

    4/10/2008

    4/10/2008

    4/10/2008

    4/15/2008

    4/15/2008

    4/9/2008

    4/9/2008

    4/9/2008

    9/10/2007

    the exact order is

    4/9/2008

    4/9/2008

    4/9/2008

    4/10/2008

    4/10/2008

    4/10/2008

    4/15/2008

    4/15/2008

    9/10/2007

    which is not coming in front so if any one have idea plz guide me

    Regards.

    Ali.

    🙂

  • make sure the datatype of the column is datetime.

    Also this can be done by casting the column to datetime

  • actually i am using a stored procedure with name of spBooks it gets one argument as book id and shows me the entire dates of related this book below is code for my stored procedure

    T-SQL

    TaskAnalysis.dbo.ufn_GetDateOnly(TaskAnalysis.dbo.tblTaskSheet.TaskDate) as TaskDate

    and the table tblTaskSheet's column TaskDate's datatype is smalldatetime so why its treating it as string or may i have to cast the entire retrieved column as date if yes then how in C# asp.net please guide me

    Regards.

    Ali.

  • can you post the code of you sp.

  • Also asked and answered here

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104588


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply