![](/img/trans.png)
[英]IErrorInfo.GetDescription failed with E_FAIL(0x80004005) C#
[英]IErrorInfo.GetDescription failed with E_FAIL(0x80004005) in asp.net c#?
我正在尝试读取一个excel文件并将该文件的内容转换为数据表但我不断收到此异常IErrorInfo.GetDescription失败,E_FAIL(0x80004005)指向一个特定的行POCCommand.Fill(dt);
这是我到目前为止所尝试的。 我能做错什么?
string POCpath = @"p.xlsx";
string POCConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + POCpath + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1\";";
OleDbConnection POCcon = new OleDbConnection(POCConnection);
OleDbCommand POCcommand = new OleDbCommand();
DataTable dt = new DataTable();
OleDbDataAdapter POCCommand = new OleDbDataAdapter("select * from [Sheet1$] ", POCcon);
POCCommand.Fill(dt);
Console.WriteLine(dt.Rows.Count);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.