Вот мой код:
Imports System.IO
Imports MySql.Data.MySqlClient
Public Class F_login
Dim strServer As String = "localhost"
Dim strDB As String = "lab_utilization"
Dim strUser As String = "root"
Dim strPw As String = ""
Dim cs As String = "Server=$($strServer);Port=3306;Database=$($strDB);Uid=$($strUser);Pwd=$($strPw);"
Dim con As New MySqlConnection(cs)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim id As Integer = uid.Text
Dim pswd As New MySqlCommand("Select Password from authentication where id = " & id & "", con)
pswd.ExecuteNonQuery()
Dim mysqladapter As New MySqlDataAdapter(pswd)
Dim dt As New DataTable
mysqladapter.Fill(dt)
dg.DataSource = dt
Dim psd As String = dg.Rows(0).Cells(0).Value
If pswd1.Text = psd Then
Me.Visible = False
F_Main_screen.Show()
Else
MessageBox.Show("Invalid ID or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
Private Sub F_login_Load(sender As Object, e As EventArgs) Handles MyBase.Load
con.ConnectionString = cs
con.Open()
End Sub
End Class
Следующее исключение происходит в con.Open ():
Необработанное исключение типа System.Collections.Generi c .KeyNotFoundException ' произошло в MySql .Data.dll Дополнительная информация: ключевое слово 'address' не найдено.
Любая помощь будет оценена, спасибо.