System.Data.OleDb.OleDbException:无效的Internet地址。如何使用OleDb连接到位于Web服务器上的excel文件 [英] System.Data.OleDb.OleDbException: Invalid internet address. How do you connect to excel files located on a webserver using OleDb

查看:672
本文介绍了System.Data.OleDb.OleDbException:无效的Internet地址。如何使用OleDb连接到位于Web服务器上的excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个OleDb连接到位于SharePoint服务器上的Excel文件。我现在玩的示例代码抛出一个OleDb异常无效的Internet地址:

I'm trying to create an OleDb connection to an Excel file that is located on a SharePoint server. The example code I'm playing with at the moment throws an OleDb exception "Invalid internet address":

public static void ConnectToRemoteExcelFile()
    {
        string connectionString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=Yes;\";", "http://horde.servername.co.uk/Docs/Documents/Sales.xlsx");

        using (OleDbConnection connection = new OleDbConnection(connectionString))
        {
            connection.Open();
        }

    }

任何人都知道如何连接到

Anyone know how to connect to an excel spread sheet on a web server?

更新

Microsoft支持已经到来回到我并同意无法连接到位于Web服务器上的Excel文件。 Jet .40和新闻ACE(Access Connectivity Engine)都不支持这种操作模式。他们引用参考知识库文章FTP或HTTP服务器上的导入/链接数据帮助主题在Access 2000,Access 2002,Access 2003和Access 2007中不正确

Microsoft support have come back to me and agree that is not possible to connect to Excel files located on a web server. Both Jet .40 and the news ACE (Access Connectivity Engine) do not support this mode of operation. They cite reference to the KB Article "The Import/Link Data on an FTP or HTTP Server Help topic is not correct in Access 2000, Access 2002, Access 2003 and Access 2007"

推荐答案

据我所知这是不可能的,你必须先下载文件,然后访问它。原因是文件无法根据其位置进行修改。

As far as I know that is not possible, you would have to download the file first, then access it. The reason being is that the file could not be modified given its location.

这篇关于System.Data.OleDb.OleDbException:无效的Internet地址。如何使用OleDb连接到位于Web服务器上的excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆