0

I'm using the following function to extract data from a CSV file:

Class CSVReader
        Public Function GetDataTable(strFileName As String) As System.Data.DataTable
            Dim conn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) + "; Extended Properties = ""Text;HDR=YES;FMT=Delimited""")
            conn.Open()
            Dim strQuery As String = "SELECT * FROM [" + System.IO.Path.GetFileName(strFileName) + "]"
            Dim adapter As New System.Data.OleDb.OleDbDataAdapter(strQuery, conn)
            Dim ds As New System.Data.DataSet("CSV File")
            adapter.Fill(ds)
            Return ds.Tables(0)
        End Function
End Class

This is working fine locally, however I've transferred the code to our development server and I'm getting the following error:

The 'Microsoft.Jet.OleDb.4.0' provider is not registered on the local machine.

I've checked the version on the server, and its 4.0.9756.0

Why am I getting this error?

Curtis
  • 98,395
  • 62
  • 265
  • 345
  • just a guess, you are working on a 64 bits computer ? try to force the 32 bit mode – Steve B Dec 15 '11 at 09:44
  • How can I force the 32 bit mode? – Curtis Dec 15 '11 at 09:50
  • @Curt - On what operating system you are running this code? – KV Prajapati Dec 15 '11 at 10:00
  • @Curt: what is your webserver ? IIS ? if yes, in the application pool advanced settings, you can force 32 bits mode byt setting "Enable 32 bits mode" to true – Steve B Dec 15 '11 at 10:25
  • @Curt, check out this question: http://stackoverflow.com/questions/1991643/microsoft-jet-oledb-4-0-provider-is-not-registered-on-the-local-machine/1992009#1992009 – neo Sep 12 '12 at 19:08

0 Answers0