开发者

fetch datetime from a Excel sheet through OleDbDataAdapter

i am facing a problem when i fetch datetime column from Excel containing CSV format values then its show null because the value on datetime column is like 50:48:12 (HH:MM:SS), but when the value is under datetime range like 23:12:32 then its working perfect...

i want to fetch the Excel column with any datetime value e.g if the value is 50:48:12 then i got the same value on Query result

my snap code is below my OleDbDataAdapter connection is string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\"" + dir + "\\\";" + "Extended Properties=\"text;HDR=No;FMT=Delimited\"";

My query is string query = "SELE开发者_开发知识库CT * FROM " + file;

OleDbDataAdapter dAdapter = new OleDbDataAdapter(query, connString);

        try
        {
            //fill the DataTable
            dAdapter.Fill(dTable);
        }

Values In Excel Sheet is 104:24:54 22:12:34 720:01:00

and if i open dataTable then

  1. value in dTable.Tables[0].Rows[0] is null
  2. value in dTable.Tables[0].Rows[1] is 10:12:34 PM
  3. value in dTable.Tables[0].Rows[2] is null

please give me any solution


Your date values are not captured in a valid format 104:24:54 & 720:01:00. 22:12:34 is the only valid one. Why are the other value higher than 24.00.00?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜