I am doing a project for a Pizzeria, the client will be able to choose the type of dough, quantity and the different ingredients, everything works perfectly except the ingredients that I don't know how to do, I have tried a CheckedListBox but I didn't know how to do it.
After trying with the CheckedListBox I have tried with different CheckedBox because what I want is that all the ingredients of the pizzas appear checked.
Eg Pizza 4 Cheeses (ingredients: Cheddar, Mozzarella, Emmental and Gorgonzola) the client can remove the ingredients that he does not want.
Well, to get to the point, I want all CheckedBoxes that are Checked to be inserted into the database that I have.
I have managed to store only one
Ingredients is a Varchar field and I want it to save all the checked items separated by commas
cmd = new SqlCommand("INSERT INTO Pizzas (Ingredientes, Cantidad, Masa, Precio) VALUES(@Ingredientes, @Cantidad, @Masa, @Precio)", con);
if (cbMozzarella.Checked)
{
cmd.Parameters.AddWithValue("@Ingredientes", cbMozzarella.Text);
}
How can I make it insert all?