![](/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.