• 遭遇 读不出excel中的文本列的数字值 及 找不到可安装的ISAM


    最后 查找和修改Excel连接字串 解决

        #region 读Excel
        private void fnReadExcel(string  strFileName ,string strSheetName,string strColumnName ,out DataSet dsData)
        {
            //strColumnName = " * ";
            string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source =" + strFileName + ";Extended Properties =  'Excel 8.0;HDR=Yes;IMEX=1;'";
            OleDbConnection oleConnection = new OleDbConnection(strConnection);
            try
            {
                oleConnection.Open();
                string strCommondText = "SELECT " + strColumnName + " FROM [" + strSheetName + "]";
                DataSet dsRead = new DataSet();
                OleDbDataAdapter oleAdper = new OleDbDataAdapter(strCommondText, oleConnection);
                oleAdper.Fill(dsRead);
                dsData = dsRead;
            }
            catch (System.Exception ex)
            {
                //throw new ApplicationException("读取数据源文件时出错");
                dsData = null;
            }
            finally
            {
                oleConnection.Close();
            }
        }
        #endregion

  • 相关阅读:
    Session机制详解
    JDK各个版本比较 JDK5~JDK9
    CAS 自旋锁
    OAuth2.0认证和授权原理
    微信二维码登录原理
    Django Restframework 实践(一)
    ESXI 5.5卡在LSI_MR3.V00
    理解RESTful架构
    RESTful API 设计指南
    python 异步 select pooll epoll
  • 原文地址:https://www.cnblogs.com/freeliver54/p/1846069.html
Copyright © 2020-2023  润新知