Search code examples
.netvb.netoledboledbconnectionoledbexception

OleDB Exception : Can-not find installable ISAM Exception, What's wrong?


I have the following code :

Imports System.Data.OleDb

 Private Sub getData()
    Dim connStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\rawData.xlsx;Extended Properties=Excel 12.0 Xml;"
    Dim oleConn As New OleDbConnection(connStr)
    Dim query As String = "SELECT * FROM [Sheet1$]"
    Dim cmd As New OleDbCommand(query, oleConn)
    Dim reader As OleDbDataReader
    oleConn.Open()                                  ' Getting Exception Here !! 
    reader = cmd.ExecuteReader()
    Do While reader.Read()
        InputOutput.print(reader.GetString(0))      ' Prints the 1st column.
    Loop
    reader.Close()
    oleConn.Close()
End Sub

Exception Text : Can-not find installable ISAM.

What am I doing wrong ?

Please help, I am a newbie !


Solution

  • Changed my connection string to :

    Dim connStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\rawData.xlsx;Extended Properties=""Excel 12.0 XML;"""
    

    And it worked like a charm.. !