public Rol(string idRol) { Nuevo = false; string Sql = "SELECT * From roles WHERE IDrol='" + idRol + "'"; ConexionBD.AbrirConexion(); SqlDataReader reader = ConexionBD.EjecutarConsultaReader(Sql); if (reader.HasRows) { reader.Read(); idRol = reader.GetString(0); nombre = reader.GetString(1); descripcion = reader.GetString(2); } ConexionBD.CerrarConexion(); }
private bool Duplicado() { bool Resultado = false; string Sql = "select * from usuario where IDUsuario='" + IDUsuario + "'"; /* * cuando trabajamos con OleDbDataReader, es necesario siempre abrir * y cerrar la conexion */ ConexionBD.AbrirConexion(); SqlDataReader reader = ConexionBD.EjecutarConsultaReader(Sql); if (reader.HasRows) { Resultado = true; } ConexionBD.CerrarConexion(); return(Resultado); }