示例#1
0
        void cardb()
        {
            String        sql = "Data Source=DESKTOP-8TO2TNB;Initial Catalog=car_sales;Integrated Security=True";
            SqlConnection con = new SqlConnection(sql);

            con.Open();
            car.Clear();

            string        query  = "SELECT *FROM car_inf where customerid is null";
            SqlCommand    cmd    = new SqlCommand(query, con);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                carclass c = new carclass {
                    car_id            = reader.GetInt32(0), makke = reader.GetString(1), price = reader.GetString(2), pic = (byte[])reader["picture"],
                    car_model         = reader.GetString(4),
                    engine            = reader.GetString(5),
                    weight            = reader.GetString(6),
                    manufacturedstate = reader.GetString(7),
                    yearestablished   = reader.GetString(8),
                    maxspeed          = reader.GetString(9),
                    tank        = reader.GetString(11),
                    details     = reader.GetString(12),
                    customer_id = xx
                                  // color = reader.GetString(12),
                };
                car.Add(c);
            }
        }
示例#2
0
        public void addd(carclass s)
        {
            label1.Text = s.makke;
            label2.Text = s.price;
            label3.Text = s.car_id.ToString();
            MemoryStream mem = new MemoryStream(s.pic);

            mem.Seek(0, SeekOrigin.Begin);
            pictureBox1.Image = Image.FromStream(mem);
            label4.Text       = "car";
            label5.Text       = s.customer_id.ToString();
        }
示例#3
0
        private void label1_Click(object sender, EventArgs e)
        {
            if (this.My_click != null)
            {
                this.My_click(this, e);
                carclass c = new carclass {
                    car_id = Int32.Parse(label3.Text), makke = label4.Text, customer_id = Int32.Parse(label5.Text)
                };
                temp.Clear();
                temp.Add(c);

                Form9 hh = new Form9(this.temp);

                hh.Show();
            }
        }
示例#4
0
        private void b_Click(object sender, EventArgs e)
        {
            foreach (Control c in flptype1.Controls)
            {
                if (c is Label)
                {
                    Label b = c as Label;
                    lab = b.Text;
                }
            }
            flpcar.Controls.Clear();
            String        sql = "Data Source=DESKTOP-8TO2TNB;Initial Catalog=car_sales;Integrated Security=True";
            SqlConnection con = new SqlConnection(sql);

            con.Open();
            car.Clear();
            string        query  = "SELECT *FROM car_inf WHERE make ='" + lab + "'";
            SqlCommand    cmd    = new SqlCommand(query, con);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                carclass c = new carclass
                {
                    car_id            = reader.GetInt32(0),
                    makke             = reader.GetString(1),
                    price             = reader.GetString(2),
                    pic               = (byte[])reader["picture"],
                    car_model         = reader.GetString(4),
                    engine            = reader.GetString(5),
                    weight            = reader.GetString(6),
                    manufacturedstate = reader.GetString(7),
                    yearestablished   = reader.GetString(8),
                    maxspeed          = reader.GetString(9),
                    tank              = reader.GetString(11),
                    details           = reader.GetString(12)
                                        // color = reader.GetString(12),
                };
                car.Add(c);
            }
            ADDCAR(car);
        }