protected void btnThem_Click(object sender, EventArgs e) { product_detail product_Detail = new product_detail(); product_Detail.color_id = int.Parse(dsMau.SelectedValue); product_Detail.quantity = int.Parse(soluong.Text); product_Detail.product_id = int.Parse(product_id.Value); dataUtils.themChiTietDienThoai(product_Detail); hienthi(product_Detail.product_id); }
public void themChiTietDienThoai(product_detail product_detail) { string themChiTietDienThoai = "insert into product_detail values(@product_id,@color_id,@quantity)"; con.Open(); SqlCommand cmd = new SqlCommand(themChiTietDienThoai, con); cmd.Parameters.AddWithValue("product_id", product_detail.product_id); cmd.Parameters.AddWithValue("color_id", product_detail.color_id); cmd.Parameters.AddWithValue("quantity", product_detail.quantity); cmd.ExecuteNonQuery(); con.Close(); }