I am using OLEDB to read information from one excel file and output it to another file in a different format. While the queries executed on the first excel file return properly, when I attempt to execute an insert query on the second file, vshost32.exe crashes when connection.Open() is called. There is an InvalidOperationException thrown on the ServerVersion of OleDBConnection when it is created, which I assume is normal, as it changes to a valid version number, and the state changes from Closed to Open when Open() is called on the connection.
Here are the connection strings that I am attempting to use. The first one is used for the first excel file, while the following one is used for writing to the output. The only discernible difference is the addition of the "ReadWrite" mode to the second string. I have also tried changing "Excel 8.0" to "Excel 12.0" in the Extended Properties.
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
inputFile + ";Extended Properties=\"Excel 8.0;HDR=YES;\"";
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
outputFile + ";Mode=ReadWrite;Extended Properties=\"Excel 8.0;HDR=YES;\"";