System.Data.OleDb.OleDbException: 无效的 Internet 地址。 如何使用 OleDb 连接到位于网络服务器上的 Excel 文件

发布于 2024-07-07 12:59:07 字数 877 浏览 9 评论 0原文

我正在尝试创建与位于 SharePoint 服务器上的 Excel 文件的 OleDb 连接。 我现在正在使用的示例代码抛出 OleDb 异常“无效的互联网地址”:

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();
        }

    }

有人知道如何连接到 Web 服务器上的 Excel 电子表格吗?

更新

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

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?

Update

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"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平定天下 2024-07-14 12:59:07

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文