[問題] C# 用OLEDB讀excel檔column超過255
1. 用OLEDB在讀取2007 excel檔時無法讀到超過255個columns之後的data
2. 當rows太多時再載入時會發生連線中斷
不知道這兩個問題有沒有辦法解決
以下附上我連線的code
strConn = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" + fileLocation +
";Extended Properties='Excel 12.0;HDR=No;IMEX=1;'";
OleDbConnection Conn = new OleDbConnection(strConn);
Conn.Open();
DataSet ds = new DataSet();
DataTable tempTable = new DataTable();
DataTable excelInfo = Conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] { null, null, null, "TABLE" });
string strSelect = "Select * From [" +
excelInfo.Rows[0]["TABLE_Name"].ToString() + "] ";
OleDbDataAdapter da = new OleDbDataAdapter(strSelect, strConn);
da.Fill(tempTable);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.210.89