How do you connet sql and vbnet?

Answer:
You can connect MySql and vbnet by download something called MySql Connecter. After you do that add the resource to your project and add this code.

Code:
'Put this at the top of your code
Imports MySql.Data.MySqlClient
'Then right click your form and add this code

Private mysql_host = "Change this to your MySql Host"
Private mysql_user = "Change this to your MySql User"
Private mysql_pass = "Change this to your MySql Password"
Private mysql_db = "Change this to your Database"

Private SqlConnect As String = "server=" + mysql_host + ";user id=" + mysql_user + "; password=" + mysql_pass + "; database=" + mysql_db
Private SqlConnection As New MySqlConnection

'Then double click your form and in the form load put this in.

SqlConnection.ConnectionString = SqlConnect
Try
If SqlConnection.State = ConnectionState.Closed Then
SqlConnection.Open()
MsgBox("Sucessfully Connected To Mysql Database")
Else
SqlConnection.Open()
MsgBox("Connection is closed.")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try

Their you go, you now you can make a stable connection with your mysql host, and database!
First answer by Ac352. Last edit by Ac352. Contributor trust: 1 [recommend contributor recommended]. Question popularity: 1 [recommend question].