Imports MySql.Data.MySqlClient
Public Class frmMain
Dim MySqlConnection As MySqlConnection = New MySqlConnection
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MySqlConnection.ConnectionString = "Server=localhost;User Id=wilson382;Password=PmYlm123;Database=wil_practice"
Try
If MySqlConnection.State = ConnectionState.Closed Then
MySqlConnection.Open()
MsgBox("Sucessfully connected to MySQL Database")
Else
MySqlConnection.Close()
MsgBox("Connection failed")
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class