Dim oWorksheet As Excel.Worksheet oWorksheet = oWorkBook.Worksheets("Monday") strDuration = oWorksheet.Range("A1:F15").Cells(4, 3).ValueThe second way ends up giving me a value of 12/30/1899 in the column when it should be :40. It returns the same value of 12/30/1899 no matter what value is displayed on the spreadsheet.
OleDbConnection ExcelConn = new OleDbConnection(); ExcelConn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0; " + "data source="C:\Timesheet\abc.xls; " + "Extended Properties=Excel 8.0;"; OleDbDataAdapter da; da = new OleDbDataAdapter("Select * from [Monday$A1:K23]", ExcelConn); da.Fill(dsTimesheetDetail, "Monday"); dgResults.SetDataBinding(dsTimesheetDetail, "Monday");The second way works fine if I am retrieving a text value or a numeric value. It only seems to have a problem with the custom format of h:mm.