Verwendung von OLEDB zum Hochladen von Dateien mit Excel 2016C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Verwendung von OLEDB zum Hochladen von Dateien mit Excel 2016

Post by Anonymous »

Meine Anwendung akzeptiert grundsätzlich eine Excel-Datei und lädt Daten in meine Datenbank hoch, die früher mit Excel 2010 mit dem folgenden Code perfekt funktionierte. Allerdings aktualisieren wir das System auf Excel 2016 und es funktioniert aus irgendeinem Grund nicht mehr. Könnten Sie mir bitte dabei helfen, welche Aktualisierungen ich an meinem Code vornehmen sollte?

Dies ist der aktuelle Code für die Verbindung:

Code: Select all

 openFileDialog1.ShowDialog();
var fileName = string.Format(openFileDialog1.FileName);

Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(fileName, 1, false, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", true, false, null, false);

var connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + "; Extended Properties=Excel 12.0;", fileName);

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post