Problème de connexion à MySql workbench
Bonjour
Votre aide m'est précieuse.
je suis entrain de créer une application VB.Net Windows forms et je souhaite tester la connexion à ma base de donner. Mais ça génère les erreurs suivantes:
Citation:
warning BC40056: Namespace or type specified in the Imports 'MySql.Data.MySqlClient' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
error BC30002: Type 'MySqlConnection' is not defined.
warning MSB3274: The primary reference "MySql.Data, Version=8.0.11.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".
J'ai beau ajouté les références ça ne marche toujours pas et je ne sais me débarrasser de ce problèmes.
mon code est le suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Imports MySql.Data.MySqlClient
Public Class Form1
Dim cnx As MySqlConnection
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
cnx = New MySqlConnection
cnx.ConnectionString = "server=localhost; userid=root; password=ninon; database=truck"
Try
cnx.Open()
MessageBox.Show("succes!")
cnx.Close()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
cnx.Dispose()
End Try
End Sub
End Class |
Merci de votre attention !