I just want to connect my mysql with vb.net code as below: But,for some reason I cant figure out the problem
i have also added the mysqldata.dll in my reference. all the input in connection string is valid and there is no error in the code. it just shows cannot connect all the time.
Public Class Form1
Dim oSQLConn As SqlConnection = New SqlConnection()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
oSQLConn.ConnectionString = "server = localhost; user id = root; password = chris; database = retail;"
TryImports System.Data.SqlClient
oSQLConn.Open()
MsgBox("Connection Open !")
Catch ex As Exception
MsgBox("cannot connect")
End Try
oSQLConn.Close()
End Sub
End Class