How do I make a successful connection to db4free.net? Do I need to download the connector/net first? I cant seem to import MySql.Data.MySqlClient
.
This is my sample code :
Imports System.Data.SqlClient
Imports mysql
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Dim MySQLConnection = New SqlClient.SqlConnection
MySQLConnection.ConnectionString = "server=db4free.net ;port=3306; user id=user; password=password; database=databasetest;"
MySQLConnection.Open()
MsgBox("Success!")
Catch ex As Exception
MsgBox("Failed!")
End Try
End Sub
End Class
Edit - By downloading the connector/net, I managed to Imports MySql.Data.MySqlClient. So thanks to adaam for pointing out the error as well Dim MySQLConnection = New SqlClient.SqlConnection
.
Here is my latest code. Managed to obtain that success message already. Am I doing right or still missing out some other important steps?
Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Dim MySQLConnection = New MySqlConnection
MySQLConnection.ConnectionString = "server=db4free.net ;port=3306; user=prav5ef; password=prav5eF; database=databasetest;"
MySQLConnection.Open()
MsgBox("Success!")
Catch ex As Exception
MsgBox("Failed!")
End Try
End Sub
End Class