错误经过:在读取Excel时,出现【"/" 应用程序中的服务器错误】之 外部表不是预期的格式
错误原因1: 由于
Excel's
97-2003的连接格式与
Excel's
2007 的 不同造成。
解决方案1:
原
Excel's
97-2003的连接串:
sbInfo.Append(
@"Provider= Microsoft.Jet.OLEDB.4.0; Data Source =");
sbInfo.Append(带路径Excel文件);
sbInfo.Append (";Extended Properties=Excel 8.0");
sbInfo.Append(带路径Excel文件);
sbInfo.Append (";Extended Properties=Excel 8.0");
Excel's 2007的连接串:
sbInfo.Append
(@"Provider=Microsoft.Ace.OLEDB.12.0;Data Source=");
sbInfo.Append(带路径Excel文件);
sbInfo.Append (";Extended Properties=Excel 12.0;");
sbInfo.Append(带路径Excel文件);
sbInfo.Append (";Extended Properties=Excel 12.0;");
(
注:
以上连接均使用了
StringBulider.)