Когда я запускаю свою программу с именем пользователя и паролем из Access, она по-прежнему показывает:
введите действительное имя пользователя и пароль
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing Or TextBox2.Text = Nothing Then
MsgBox("Enter Username and password", MsgBoxStyle.Exclamation
)
Else
If connection.State = ConnectionState.Closed Then
connection.Open()
End If
Dim cmd As New OleDbCommand("select count(*)from login where Username and Password=?", connection)
cmd.Parameters.AddWithValue("@1", OleDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.AddWithValue("@2", OleDbType.VarChar).Value = TextBox2.Text
Dim count = Convert.ToInt32(cmd.ExecuteScalar())
cmd.Dispose()
connection.Close()
If (count > 0) Then
MsgBox("Login Sucessful", MsgBoxStyle.Information)
Else
MsgBox("please enter valid username and password", MsgBoxStyle.Critical)
End If
End If
End Sub
End Class