oledb connection string for Excel 2016 in C#

前端 未结 2 650
误落风尘
误落风尘 2021-02-09 01:00

I have been trying to access 2016 MS Excel file using C#, but connection string is working only till 2013 MS Excel.

My current connection string:

2条回答
  •  独厮守ぢ
    2021-02-09 01:40

    This worked for me:

    private string ExcelConnection(string fileName)
    {
        return @"Provider=Microsoft.Jet.OLEDB.4.0;" +
               @"Data Source=" + fileName + ";" +
               @"Extended Properties=" + Convert.ToChar(34).ToString() +
               @"Excel 8.0" + Convert.ToChar(34).ToString() + ";";
    }
    

提交回复
热议问题