0

I'm new in vb .net programming, I've been encountering the following error when I'm trying to connect my form button to MySql database that:

An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll Additional information: Keyword not supported.

I have been working to sort this error but I didn't succeed. Please see my code for the class below:

Imports MySql.Data.MySqlClient
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim connect As New MySqlConnection
        Dim connecto As String = "Server=localhost; User Id=root; Password; Database=sist"
        connect.ConnectionString = connecto
        Try
            connect.Open()
            MessageBox.Show("Connected Successfully")
        Catch ex As MySqlException
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class
4

1 回答 1

1

检查您的连接字符串。根据这个它应该看起来像这样:

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

所以在你的情况下:

Dim connecto As String = "Server=localhost; Uid=root; Pwd=yourPassword; Database=sist"
于 2014-10-24T22:10:55.240 回答