// string fPath = this.excelFile.PostedFile.FileName;//获得要导入的文本文件
string extName = excelFile.Substring(excelFile.LastIndexOf(".") + 1);//获得文件的扩展名
string strConn;
if (extName == "xls")
{
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + excelFile + ";" + "Extended Properties=Excel 8.0;";
}
else
{
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;"+"Data Source=" + excelFile + ";" + "Extended Properties=Excel 12.0;";
}
导入EXCEL文件时区分03和07版的0307版
最新推荐文章于 2021-12-01 09:13:50 发布