locked
reading from excel column RRS feed

  • Question

  • User1297843351 posted

     Hi all.

    I am reading from an excel file using c#, i have a column with a date as a value, the dates are writen in different ways, i am reading it as a string, my problem is if the date is writen like 20/11/2013  i am able to read fine,

    but if the date is written as 20.nov.13 am getting somthing like this 41229

    any idea why this is happening..?

     

     

    Saturday, March 30, 2013 10:56 AM

Answers

All replies

  • User-2067077449 posted

    when u read from Excel that time convert the date into sutable format like.

    select convert(varchar(10),GETDATE(), 101)

    it will return the format like- 03/30/2013

    but it may the Dot in ur date can create issue.

    Saturday, March 30, 2013 12:40 PM
  • User1297843351 posted

    @Ravi kant

    i am reading it with this line of code:

     n.arival = (((Microsoft.Office.Interop.Excel.Range)xlWorksheet.Cells[i, 6]).Value2 == null) ? "" : ((Microsoft.Office.Interop.Excel.Range)xlWorksheet.Cells[i, 6]).Value2.ToString();

     

     

    Saturday, March 30, 2013 12:53 PM
  • User-2067077449 posted

    Same issue is in thread and sloved. visit this link

    http://forums.asp.net/t/1657365.aspx/1

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 30, 2013 2:58 PM
  • User1297843351 posted

    @Ravi kant

    thanks for your reply. this solved my problem.

     

     

    Saturday, March 30, 2013 3:55 PM