Me estoy volviendo loco con mi primer formulario Usuario-Password de validación. No le encuentro salida. Tengo esto:
Dim strConexion As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\BD\Usuarios.mdb"
conexion = New OleDbConnection(strConexion)
conexion.Open()
Dim strComan As String = "SELECT Usuario, Contraseña FROM Usuarios WHERE Usuario = '" & txtUsu.Text & "'" & " AND Contraseña = '" & txtContra.Text & "'"
Dim coman As New OleDbCommand(strComan, conexion)
Dim resul As OleDbDataReader
Dim inicio As New Form2
Try
If txtContra.Text = "" And txtUsu.Text = "" Then
MsgBox("DEBE INTRODUCIR ALGUN DATO", MsgBoxStyle.Exclamation)
VaciarControles()
txtUsu.Focus()
Else
resul = coman.ExecuteReader()
Dim blnOK As Boolean = False
If resul.Read() Then
blnOK = True
End If
resul.Close()
conexion.Close()
If Not blnOK Then
MsgBox("ERROR: USUARIO Y/O CONTRASEÑA INCORRECTOS", MsgBoxStyle.Critical)
VaciarControles()
Else
psUsuario = txtUsu.Text
psContra = txtContra.Text
inicio.Show()
Me.Close()
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
El caso es que cuando valido con los TXTs vacíos me salta el Msgbox ("DEBE INTRODUCIR ALGUN DATO") e inmediatamente después ("ERROR: USUARIO Y/O CONTRASEÑA INCORRECTOS") abriendo el Form2...
