System.Data.OleDb.OleDbException: Invalid internet address. How do you connect to excel files located on a webserver using OleDb

萝らか妹 提交于 2019-12-01 02:17:46

问题


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"


回答1:


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.



来源:https://stackoverflow.com/questions/226524/system-data-oledb-oledbexception-invalid-internet-address-how-do-you-connect-t

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!