解决c#处理excel时故障 找不到可安装的 isam

直接拷贝的以前代码,但因软件版本,系统环境的变化,导致提示“找不到可安装的 isam”。

我目前新的软件环境:win8.1+office2010+vs2013

解决办法是修改连接字符串:

处理excel2003的连接字符串是

string connectionString = String.Format("Provider=Microsoft.ACE.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'", fileName);

处理excel2007、2010连接字符串两点不同:

string connectionString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0 Xml;HDR=Yes;IMEX=1'", fileName);

posted on 2015-05-29 14:51  心中无言  阅读(364)  评论(0编辑  收藏  举报