Ejemplo n.º 1
0
        public Articulo(int idArticulo)
        {
            try
            {
                sql.open();
                MySqlDataReader sqlRead = sql.query("SELECT * FROM articulos WHERE id = " + idArticulo.ToString());
                if (sqlRead.HasRows)
                {
                    sqlRead.Read();

                    id            = sqlRead.GetInt32(0);
                    nombre        = sqlRead.GetString(1);
                    precio        = sqlRead.GetFloat(2);
                    descripcion   = sqlRead.GetString(3);
                    existencia    = int.Parse(sqlRead.GetString(4));
                    cantidadVenta = 1;

                    sqlRead.Close();
                }
                sql.close();
            }
            catch
            {
            }
        }