110,533
社区成员
发帖
与我相关
我的任务
分享
private static string ConnectionString(string fileName)
{
bool isExcel2003 = fileName.EndsWith(".xls");
string connectionString = string.Format(
isExcel2003
? "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;"
: "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES\"",
fileName);
return connectionString;
}