0

I watched a tutorial and all codes where copied except for the path. But i get the error Could not find installable ISAM in the cn.open()

Here is the overall code:

Imports System.Data.OleDb
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OlEDB.4.0; Data Source:G:\Book1.xlsx;Extend Properties=Excel 8.0;")
        cn.Open() <--Error Here

        Dim da As New OleDbDataAdapter("Select * from [Sheet1$]", cn)
        Dim dt As New DataTable

        With DataGridView1
            .AllowUserToAddRows = False
            .DataSource = dt
        End With

        dt.Dispose()
        dt = Nothing
        da.Dispose()
        da = Nothing

        With cn
            .Close()
            .Dispose()
        End With
        cn = Nothing

    End Sub
    End Class

I hope anyone could help me. Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ako Ci Divine
  • 69
  • 3
  • 13
  • possible duplicate of [Could not find installable ISAM](http://stackoverflow.com/questions/4214527/could-not-find-installable-isam) – ale Sep 27 '15 at 12:34
  • @WinterMute this cant be a duplicate because the solutions provided in the other questions didnt solved m problem. Im using VB.net not ASP and MySql not Access – Ako Ci Divine Sep 27 '15 at 12:58

1 Answers1

0

Since you are using an .xlsx file, you need to use the ACE.OLDB.12.0 driver:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Book1.xlsx;Extended Properties=Excel 12.0"

Notice the Source is assigned using and "=" sign, not a colon ":"

ron tornambe
  • 10,452
  • 7
  • 33
  • 60