Código:
private void iniciar_Click(object sender, EventArgs e){ OleDbConnection conexion = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\DataBase.mdb;Jet OLEDB:Database Password=20732327"); conexion.Open(); string candena = "SELECT * FROM usuario WHERE usuario='" + user.Text + "' AND clave='" + clave.Text + "';"; OleDbCommand consulta = new OleDbCommand(candena, conexion); OleDbDataReader resull; resull = consulta.ExecuteReader(); Boolean ressul_verifica = resull.HasRows; if(ressul_verifica){ MDIConsola frm = new MDIConsola(); frm.Show(); this.Hide(); } else { MessageBox.Show("Usuario no registrado o contraseña incorrecta: " + user.Text, "Contro universitariol", MessageBoxButtons.OK, MessageBoxIcon.Error); } conexion.Close(); }