【问题标题】:Importing data from excel 2007 ASP.net从 excel 2007 ASP.net 导入数据
【发布时间】:2011-05-16 13:35:30
【问题描述】:

你好,有没有办法从 excel 2007 文件中导入数据?它正在与 excel 2003 一起使用,但在尝试使用 2007 时出现错误是否有任何参考我应该遵循,请建议我仍然是新的@this。

【问题讨论】:

    标签: asp.net excel-2007 import-from-excel


    【解决方案1】:

    您的连接字符串将取决于您的 Office 2007 和 2003 支持

     if (System.IO.Path.GetExtension(fup.FileName) == ".xls")
        {
            connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/upload/temp/File.xls") + "; Extended Properties=Excel 8.0;";
        }
        else if (System.IO.Path.GetExtension(fup.FileName) == ".xlsx")
        {
            connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/upload/temp/File.xlsx") + "; Extended Properties=Excel 12.0;";
        }
    

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 2010-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多