3
當我嘗試從我的xlsx文件中讀取記錄時出現錯誤。
錯誤是「無法更新,數據庫或對象是隻讀的。」
我已驗證該文件不是隻讀的。任何想法可能會導致錯誤?從C#中的xlsx文件獲取記錄時出錯#
我的代碼是:
string strFileName = System.IO.Path.GetFileName(txtSourcePath.Text);
string strFilePath = txtSourcePath.Text;
string strDirectoryPath = strFilePath.Substring(0, (txtSourcePath.TextLength - (strFileName.Length + 1)));
string conn = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}; Extended Properties=""text;HDR=YES;FMT=DELIMITED""", strDirectoryPath);
OleDbConnection oleDBConn = new OleDbConnection(conn);
oleDBConn.Open();
OleDbDataAdapter da = new OleDbDataAdapter("Select * FROM [" + strFileName + "]", conn);
DataSet ds = new DataSet();
da.Fill(ds);
當我將鼠標懸停在ds
我沒有看到需要安裝任何記錄