[VB.NET] ODBC koppeling

Pagina: 1
Acties:

  • kaandorp
  • Registratie: November 1999
  • Laatst online: 16-08 20:11
Ik probeer met VB.NET een connectie te maken naar MySQL met ODBC.

Ik maak gewoon een standaard Windows Application aan en volg de manual op mysql.com enzo:

Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Imports Microsoft.Data.Odbc

Public Class Form1
    Inherits System.Windows.Forms.Form

    Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" + _
        "SERVER=localhost;" + _
        "DATABASE=test;" + _
        "UID=blah;" + _
        "PASSWORD=blah;" + _
        "OPTION=3"

    Dim MyConnection As New OdbcConnection(MyConString)

End Class


MyConnection heeft echter geen attributen. Als ik MyConnection.Open() erbij tik dan geeft hij de error "Declaration Expected" op die regel. :?

  • kaandorp
  • Registratie: November 1999
  • Laatst online: 16-08 20:11
Omdat ik hem in de declarations zet. Erg dom dus.. GOOI MAAR DICHT!