Imports MySql.Data.MySqlClient

Module MySQL

    Public Function CON_STRING() As String

        With My.Settings

            Return "Server=" & .server & "; Port=" & .port & "; Database=" & .database & "; Uid=" & .userid & "; Pwd = " & .password & ";"

        End With

    End Function

    Public Function CON_TEST(Server As String, Port As Integer, Database As String, UserName As String, Password As String) As Boolean

        Dim CON_TEST_STRING As String = "server=" & Server & "; Port=" & Port & "; user id=" & UserName & "; password=" & Password & "; database=" & Database & ";"
        Dim CON As New MySqlConnection(CON_TEST_STRING)

        Try
            CON.Open()
            CON.Close()
            MessageBox.Show("Connection Sucessfull")
            Return True
        Catch ex As MySqlException
            MessageBox.Show(ex.Message)
            Return False
        End Try

    End Function

End Module
