probleme de connexion mysql
j un probleme de connexion j'arrive pas a me connecté a ma base de donnée j tous fait mais rien ca marche pas:cry:
j'utilise VB 2008 express sp1 et je travaille sur les open source (dolibarr en particulier) voici le code que j effectuer a fin de tester la connexion( c la premeire fois que j manipule les open source)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Conn As MySqlConnection
Conn = New MySqlConnection()
Conn.ConnectionString = "server=localhost;user id=utilisateur;password=1234;database=dolibarr"
Try
Conn.Open()
Dim myCommand As New MySqlCommand
Dim MyAdapt As New MySqlDataAdapter
Dim myDataTable As New DataTable
Dim strQuery As String
strQuery = "SELECT " & "Table llx_product.ref " & "FROM " & "Table llx_product"
myCommand.Connection = Conn
myCommand.CommandText = strQuery
MyAdapt.SelectCommand = myCommand
MyAdapt.Fill(myDataTable)
For i As Integer = 0 To myDataTable.Rows.Count - 1
MsgBox(myDataTable.Rows(i)("ref").ToString)
Next
Catch
MsgBox("erreur")
End Try |
et merci d'avance:)