C# 讀取excel
//限.xlsx
string filePath = @"C:\Documents and Settings\USER\桌面\各縣市彙整.xlsx";
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\";";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbDataAdapter oleDBdataAdapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
DataSet dataSet = new DataSet();
oleDBdataAdapter.Fill(dataSet);
標籤: c#
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁