日期:2014-05-18 浏览次数:20898 次
strExcel = "select * from [sheet1$]";[
OleDbConnection excelConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";"); excelConn.Open(); DataTable sheetsName = excelConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,null); foreach (DataRow dr in sheetsName.Rows) { Console.WriteLine(dr["TABLE_NAME"]); }