Beispiel #1
0
        public void DeleteProductByCategory(int categoryID)
        {
            DeleteSalesByProduct(reader.GetProductsIDFromCatID(categoryID));
            MySqlConnection conn = new MySqlConnection(ConnStr);

            using (conn)
            {
                conn.Open();

                MySqlCommand cmd = conn.CreateCommand();
                cmd.CommandText = "DELETE FROM products WHERE categoryID = @categoryID";
                cmd.Parameters.AddWithValue("categoryID", categoryID);
                cmd.ExecuteNonQuery();
            }
        }