コード例 #1
0
        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();
        }
コード例 #2
0
        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);
        }