zoukankan      html  css  js  c++  java
  • myOleDbConnection.GetOleDbSchemaTable异常

    代码如下:

    string strServerPath = Server.MapPath(Request.ApplicationPath +"/Excelfiles/") + sFileName;
       
       //建立和EXCEL文件的连接
       OleDbConnection myOleDbConnection  = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+strServerPath+";Extended Properties=Excel 8.0;");
       //打开连接
       myOleDbConnection.Open();
       //取得EXCEL文件中的工作表
       DataTable schemaTable = myOleDbConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables,null);
             
       ***
          
       if(myOleDbConnection.State == ConnectionState.Open)
       {
          myOleDbConnection.Close();
       }

    //
    程序在自己机器上测试没有问题,在其他机器上测试时,有的机器报: 
    Exception Details: System.Data.OleDb.OleDbException: 未指定的错误 

    网上找了好久,终于找到答案:重启一下就好了。或者把web服务的相关进程结束掉了就行。

    给我答案的页面:
    http://www.chinaaspx.com/Comm/Dotnetbbs/Showtopic.aspx?Forum_ID=5&id=101689&Page=1

  • 相关阅读:
    REST
    Bootstrap
    深入浅出聊聊企业级API网关
    Message Queue
    pyspark
    贝叶斯解读
    Leetcode#95 Unique Binary Search Trees II
    Leetcode#24 Swap Nodes in Pairs
    Leetcode#147 Insertion Sort List
    Leetcode#98 Validate Binary Search Tree
  • 原文地址:https://www.cnblogs.com/shiningrise/p/1218423.html
Copyright © 2011-2022 走看看