private void iniboton_Click(object sender, EventArgs e) { c = new Conexion(); c.Comando("SELECT * FROM Usuario WHERE nuUsuario = '" + usertext.Text + "' AND contraUser = '******' ; "); SqlDataReader lee; c.OpenCnn(); lee = c.LeerDatos(); int cont = 0; String id = ""; while (lee.Read()) { cont = cont + 1; id = lee.GetInt32(15).ToString(); codci = lee.GetInt32(0); nom = lee.GetString(1); nameUser = lee.GetString(3); } if (cont == 1) { if (id == "1") { Principal e1 = new Principal(); e1.Cod = codci; e1.Nom = nom; e1.NameUser = nameUser; e1.Show(); this.Hide(); c.CerrarCnn(); } else { Principal_UserCajero e2 = new Principal_UserCajero(); e2.Cod = codci; e2.Nom = nom; e2.NameUser = nameUser; e2.Show(); this.Hide(); c.CerrarCnn(); } } else if (cont > 1) { MessageBox.Show("ERROR. El Usuario A sido Duplicado, Contacte Con el Administrador.", " ", MessageBoxButtons.OK, MessageBoxIcon.Error); passtext.Text = ""; //c.CerrarCnn(); } else { MessageBox.Show("ERROR. El Usuario No Existe, Intente Nuevamente.", " ", MessageBoxButtons.OK, MessageBoxIcon.Error); passtext.Text = ""; //c.CerrarCnn(); } }