0

Good morning.

I'm in the process of writing a vb.NET forms application that will read in a selection of .xlsX files and import their contents into a SQL2012 database. Because the files are in different folders and are all formatted differently, I'm having to write it so that each folder's contents is handled by its own dedicated module. However, one thing that's common across each folder is the process that I need to go through, which is to open each file, read its contents into a DataTable, carry out any manipulation required (i.e. removing empty rows) and then run a SqlBulkCopy to load the data into SQL before moving the original file into an archive location.

So far, so good. I've written and successfully run three of these modules, but the fourth one is giving me the error that's detailed in the Title of this post - the exception is thrown at the point where I'm trying to open the connection string to the Excel object. Again I stress that I've done this three times before, and each time has been successful.

Also, I've noticed that the exception only occurs when running the code in Debug mode. If I run it in Release mode it works without any complaints.

I'm developing this application in a 64-bit environment (VS2010 on Windows 8.1), but targeting the application to x86. I'm happy to continue writing in Release rather than Debug mode, but I'm curious as to why it works in one but not the other and I'd like to be able to code for both modes if at all possible.

TIA

Hendo73
  • 1
  • 1
  • Could you provide source code? It will help in problem analysis. – Maciej Nowicki Apr 15 '15 at 11:09
  • possible duplicate of [The 'Microsoft.ACE.OLEDB.12.0' provider is not registered in the local machine](http://stackoverflow.com/questions/1646409/the-microsoft-ace-oledb-12-0-provider-is-not-registered-in-the-local-machine) – Ňɏssa Pøngjǣrdenlarp Apr 15 '15 at 12:31
  • cnXL is instantiated here: Public cnXL As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=NO'" xcConn is instantiated from here: xlConn = String.Format(cnXL, SourceFile) The code breaks at this point: If cnXL2.State = ConnectionState.Closed Then cnXL2.Open() The whole subroutine is encased in a USING statement, thus: Using cnXL2 As New OleDbConnection(xlConn) – Hendo73 Apr 16 '15 at 14:57

0 Answers0