程序中去读EXCEL文档,以前一直参考《Asp.net读取Excel文件 2http://www.cnblogs.com/insus/archive/2011/05/05/2037808.html这个连接语句或是方法。

但在这次开发中,再次引用时,即出现了异常:“Could not find installable ISAM”。

奇怪!

经过一番查阅资料和修改,Insus.NET把代码稍作修改一调整:

程序又可以跑起来了...

 public static string ExcelConnectionString(string filePhysicalPath)
{
string connectionString = string.Empty;
string fileExtension = filePhysicalPath.Substring(filePhysicalPath.LastIndexOf(".") + );
switch (fileExtension)
{
case "xls":
connectionString = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1\"", filePhysicalPath);
break;
case "xlsx":
connectionString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES\"", filePhysicalPath);
break;
}
return connectionString;
}

Source Code

Could not find installable ISAM的更多相关文章

  1. C# Oledb 连接Access数据库字符串

    string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbFile + ";Persist ...

  2. composer 报错:Your requirements could not be resolved to an installable set of packages 解决方法

    composer 报错: - Your requirements could not be resolved to an installable set of packages xxxxxxxxxxx ...

  3. C# EXCEL导入 混合列文字为空,找不到可安装的 ISAM的解决办法

    C# EXCEL导入 混合列文字为空,找不到可安装的 ISAM的解决办法 使用C#导入 Excel数据到 DataTable,如果连接串中只写 Excel 8.0,则正常的字符列,数值列都没有问题,但 ...

  4. System.DateUtils 3. IsPM、IsAM 判断是否为上、下午

    编译版本:Delphi XE7 function IsPM(const AValue: TDateTime): Boolean; inline;function IsAM(const AValue: ...

  5. (转)MySQL数据库引擎ISAM MyISAM HEAP InnoDB的区别

    转自:http://blog.csdn.net/nightelve/article/details/16895917 MySQL数据库引擎取决于MySQL在安装的时候是如何被编译的.要添加一个新的引擎 ...

  6. 找不到可安装的ISAM

    转载:http://www.cnblogs.com/zyc2/archive/2005/06/28/182492.html   读取excel数据 到 datagrid 出现:找不到可安装的ISAM  ...

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

    直接拷贝的以前代码,但因软件版本,系统环境的变化,导致提示“找不到可安装的 isam”. 我目前新的软件环境:win8.1+office2010+vs2013 解决办法是修改连接字符串: 处理exce ...

  8. MySQL引擎介绍ISAM,MyISAM,HEAP,InnoDB

    MySQL数据库引擎取决于MySQL在安装的时候是如何被编译的.要添加一个新的引擎,就必须重新编译MYSQL. 在缺省情况下,MYSQL支持三个引擎:ISAM.MYISAM和HEAP.另外两种类型IN ...

  9. 读取excel数据 到 datagrid 出现 找不到可安装的ISAM

    读取excel数据 到 datagrid 出现:找不到可安装的ISAM       错误: 实在没有办法了 就仔细的查看了 一下数据链接字符串: string strConn = "Prov ...

随机推荐

  1. 使用GZipStream压缩和解压文件

    最近做了一个用.NET里的GZipStream压缩解压缩gzip文件的小程序. GZipStream在System.IO.Compression底下,使用起来也很简单.虽然GZipStream是Str ...

  2. 校园网ipv6连接问题

    没有ipv6的信号:只需要进入网络适配器里面先禁用再启用即可.

  3. html5 data-*自定义属性取值

    demo: <!DOCTYPE HTML> <html> <head> <title></title> <meta http-equi ...

  4. 如何使用Log4j

    如何使用Log4j? 1. Log4j是什么?   Log4j可以帮助调试(有时候debug是发挥不了作 用的)和分析,要下载和了解更详细的内容,还是访问其官方网站吧: http://jakarta. ...

  5. mybatis @SelectKey加于不加的区别

    正常情况下,我们设置表的主键自增,然后: @Insert("insert into miaosha_order (user_id, goods_id, order_id)values(#{u ...

  6. Windows 8风格应用-触控输入

    参考:演练:创建您的第一个触控应用程序 http://msdn.microsoft.com/zh-cn/library/ee649090(v=vs.110).aspx win8支持多点触摸技术,而我们 ...

  7. Linux CPU Hotplug CPU热插拔

    http://blog.chinaunix.net/uid-15007890-id-106930.html   CPU hotplug Support in Linux(tm) Kernel Linu ...

  8. python学习 day20 (3月27日)----(单继承多继承c3算法)

    继承: 提高代码的重用性,减少了代码的冗余 这两个写法是一样的 Wa('青蛙').walk() #青蛙 can walk wa = Wa('青蛙') wa.walk() #青蛙 can walk 1. ...

  9. 使用delphi-cross-socket 开发kbmmw smart http service

    前几天我说了使用delphi-cross-socket 扩展kbmmw 的跨平台支持,今天我说一下使用 kbmMWCrossScoketHttpServerTransport 在linux 下支持 k ...

  10. IntelliJ IDEA 2017版 Spring5 的RunnableFactoryBean配置

    1.新建RunnableFactoryBean package com.spring4.pojo; import org.springframework.beans.factory.FactoryBe ...