-
Installable ISAM
The short code here produces an error 'Could not find intallable ISAM' - and I'm not sure what this means or why there's an error.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connString As String
Dim mdbPath As String
Dim cn As OleDb.OleDbConnection
Try
mdbPath = "C:\Test\Test.mdb"
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Test\Test.xls;Extended Properties= Excel 8.0;HDR=Yes;IMEX=1"
connString = String.Format(connString, mdbPath)
cn = New OleDb.OleDbConnection(connString)
cn.Open()
MessageBox.Show("Connection opened")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
-
Re: Installable ISAM
It means either your connection string is not correct, or you do not have the correct driver installed.
It looks to me as if your connection string isn't quite right, so check the examples in the Connection Strings link in my signature.
If that doesn't help, see the "Fixing Common DB errors" link in my signature for further explanation of this error, and a link to download the Jet driver.
-
Re: Installable ISAM
Thanks I can get the code to work if I add a test.mdb Access file via the data source wizard. I'm struggling trying to make an Excel file the data source instead as this is a data file I have to send to be read by other users just as an Excel file (they don't use Access). Editing the project Config file doesn't seem to do it. I've tried using the Excel connection string as a Form Load but I still don't seem to have hit on the exact code to do this. Any help you can give to use the Excel file as the data source is appreciated. Does the data source Wizard want an Object instead? (I'm migrating from VB6 so this is a steep learning curve at present)
-
Re: Installable ISAM
In that case it seems that the driver is installed.
I don't know what you are doing with String.Format (as I don't use .Net enough), but at the cn = New line the value of connString needs to be a valid connection string, which it does not appear to be.
Take a look at the examples I referred to, and make sure that connString (at the cn = New line) is the same format as them.