示例#1
0
        public static int AgregarRef(MySqlConnection conexion, Refrigerios re)
        {
            int          retorno = 0;
            MySqlCommand comando = new MySqlCommand(String.Format("INSERT INTO refrigerios ( ref_nombre, ref_contenido) VALUES ('{0}', '{1}')", re.nombre, re.contenido_ref), conexion);

            retorno = comando.ExecuteNonQuery();
            return(retorno);
        }
示例#2
0
        public static int ModificarRef(MySqlConnection conexion, Refrigerios re)
        {
            int retorno = 0;

            MySqlCommand comando = new MySqlCommand(String.Format("UPDATE refrigerios SET  ref_nombre='{1}', ref_contenido='{2}'  WHERE id_ref='{0}' ", re.id_ref, re.nombre, re.contenido_ref), conexion);

            retorno = comando.ExecuteNonQuery();
            return(retorno);
        }
示例#3
0
        public static int EliminarRef(MySqlConnection conexion, Refrigerios re)
        {
            int retorno = 0;

            MySqlCommand comando = new MySqlCommand(String.Format("DELETE FROM refrigerios WHERE id_ref='{0}' ", re.id_ref), conexion);

            retorno = comando.ExecuteNonQuery();
            return(retorno);
        }
示例#4
0
        public static int ExisteRef(MySqlConnection conexion, Refrigerios re)
        {
            int             id_ref  = 0;
            MySqlCommand    comando = new MySqlCommand(String.Format("SELECT id_ref FROM refrigerios WHERE ref_nombre='{0}' AND ref_contenido='{1}' ", re.nombre, re.contenido_ref), conexion);
            MySqlDataReader leer    = comando.ExecuteReader();

            while (leer.Read())
            {
                id_ref = leer.GetInt32(0);
            }

            return(id_ref);
        }