[英]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... 当我从包含CSV格式值的Excel中获取datetime列时,我遇到了一个问题,因为它显示为null,因为datetime列上的值像50:48:12(HH:MM:SS),但是当值在datetime范围之内时23:12:32然后它的工作完美...
i want to fetch the Excel column with any datetime value eg if the value is 50:48:12 then i got the same value on Query result 我想获取具有任何日期时间值的Excel列,例如,如果值是50:48:12,那么我在查询结果中得到的值是相同的
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\\"";
我的快照代码在我的OleDbDataAdapter连接下面是
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\\"" + dir + "\\\\\\";" + "Extended Properties=\\"text;HDR=No;FMT=Delimited\\"";
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\\"" + dir + "\\\\\\";" + "Extended Properties=\\"text;HDR=No;FMT=Delimited\\"";
My query is string query = "SELECT * FROM " + file;
我的查询是
string query = "SELECT * 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 Excel工作表中的值是104:24:54 22:12:34 720:01:00
and if i open dataTable then 如果我打开dataTable然后
please give me any solution 请给我任何解决方案
Your date values are not captured in a valid format 104:24:54 & 720:01:00. 您的日期值未以有效格式104:24:54&720:01:00捕获。 22:12:34 is the only valid one.
22:12:34是唯一有效的。 Why are the other value higher than 24.00.00?
为什么其他值高于24.00.00?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.