I using
VB.NET develop my application which need to connect to the MYSQL 5.0 database server which is not localhost server. I don't know how to connect remotely to the MySQL 5.0 database server...
I have wrote some codes which show below :
Imports MySql.Data.MySqlClient
Imports MySql.Data.MySqlClient.MySqlConnection
Imports MySql.Data.MySqlClient.MySqlException
Imports MySql.Data.MySqlClient.MySqlCommand
Public Class Form1
Inherits System.Windows.Forms.Form
Dim conn As New MySqlConnection
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
Dim sConnectionString As String _
="Server=pm1-fs;User ID=root;password=iloveyou;"
Dim conn As New MySqlConnection(sConnectionString)
Try
conn.Open()
MessageBox.Show("Connection Opened Successfully")
conn.Close()
Catch myerror As MySqlException
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
Finally
conn.Dispose()
End Try
End Sub
End Class
Anybody help me check.....?
Thank You.
cwliong