//========================================================
        //
        //public static string AddFoodStuff(FoodStuff fs, List<Recipe> ingredients)
        //{
        //    //insert a foodstuff entry in the Foodstuff table
        //    //will use comma-delineated string for the tags
        //    try
        //    {
        //        //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
        //        //database will auto-default to NULL for the rest.
        //        string query = "insert into Foodstuff(FoodstuffID, Name"; //these two must always be there
        //        DataConnection.OpenConnection();
        //        OleDbDataReader rdItemCount = new OleDbCommand("Select Count(Name) from Foodstuff", conn).ExecuteReader();
        //        rdItemCount.Read();
        //        DataConnection.CloseConnection();
        //        OleDbCommand cmd = new OleDbCommand();
        //        cmd.Connection = conn;
        //        //if statements for each value to add, and its associated parameter
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.ID;// +Convert.ToInt32(rdItemCount[0]).ToString("0000#");
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Name;
        //        int intParameterCount = 2;
        //        if (fs.Directions != "")
        //        {
        //            query += ", Directions";
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Directions;
        //            intParameterCount++;
        //        }
        //        if (fs.PrepTime > -1) //use -1, items may still have 0 prep time
        //        {
        //            query += ", PrepTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.PrepTime;
        //            intParameterCount++;
        //        }
        //        if (fs.CookTime > -1)
        //        {
        //            query += ", CookTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.CookTime;
        //            intParameterCount++;
        //        }
        //        if (fs.Cost > 0.0) //unlikely anything is going to be free
        //        {
        //            query += ", Cost";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Cost;
        //            intParameterCount++;
        //        }
        //        if (fs.Servings > 0)
        //        {
        //            query += ", Servings";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Servings;
        //            intParameterCount++;
        //        }
        //        if (fs.GetTags() != "")
        //        {
        //            query += ", Tags";
        //            //Comma-and-space delineated list of the tags.
        //            //When tokenizing or splitting tags, use ", " for the demarcation.
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.GetTags();
        //            intParameterCount++;
        //        }
        //        query += ") Values(?";
        //        for (int i = 0; i < intParameterCount-1; i++)
        //        {
        //            query += ",?";
        //        }
        //        query += ")";
        //        cmd.CommandText = query;
        //        DataConnection.OpenConnection();
        //        cmd.ExecuteNonQuery();
        //        foreach (Recipe r in ingredients)
        //            AddRecipeItem(r);
        //        return "Item plus ingredients added.";
        //    }
        //    catch (Exception ex)
        //    {
        //        return ex.ToString();
        //    }
        //    finally
        //    {
        //        DataConnection.CloseConnection();
        //    }
        //}
        //public static string AddFoodStuff(FoodStuff fs, Recipe r)
        //{
        //    //same as other but for just adding single Recipe elements instead of from a list.
        //    //insert a foodstuff entry in the Foodstuff table
        //    //will use comma-delineated string for the tags
        //    try
        //    {
        //        //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
        //        //database will auto-default to NULL for the rest.
        //        string query = "insert into Foodstuff(FoodstuffID, Name"; //these two must always be there
        //        OleDbDataReader rdItemCount = new OleDbCommand("Select Count(Name) from Foodstuff", conn).ExecuteReader();
        //        rdItemCount.Read();
        //        OleDbCommand cmd = new OleDbCommand();
        //        cmd.Connection = conn;
        //        //fs.ID += Convert.ToInt32(rdItemCount[0]).ToString("0000#");
        //        //if statements for each value to add, and its associated parameter
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.ID;// +Convert.ToInt32(rdItemCount[0]).ToString("0000#");
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Name;
        //        int intParameterCount = 2;
        //        if (fs.Directions != "")
        //        {
        //            query += ", Directions";
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Directions;
        //            intParameterCount++;
        //        }
        //        if (fs.PrepTime > -1) //use -1, items may still have 0 prep time
        //        {
        //            query += ", PrepTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.PrepTime;
        //            intParameterCount++;
        //        }
        //        if (fs.CookTime > -1)
        //        {
        //            query += ", CookTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.CookTime;
        //            intParameterCount++;
        //        }
        //        if (fs.Cost > 0.0) //unlikely anything is going to be free
        //        {
        //            query += ", Cost";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Cost;
        //            intParameterCount++;
        //        }
        //        if (fs.Servings > 0)
        //        {
        //            query += ", Servings";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Servings;
        //            intParameterCount++;
        //        }
        //        if (fs.GetTags() != "")
        //        {
        //            query += ", Tags";
        //            //Comma-and-space delineated list of the tags.
        //            //When tokenizing or splitting tags, use ", " for the demarcation.
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.GetTags();
        //            intParameterCount++;
        //        }
        //        query += ") Values(?";
        //        for (int i = 1; i < intParameterCount; i++) //counter is one-based
        //        {
        //            query += ",?";
        //        }
        //        query += ")";
        //        cmd.CommandText = query;
        //        AddRecipeItem(r);
        //        DataConnection.OpenConnection();
        //        cmd.ExecuteNonQuery();
        //        return "Item plus ingredients added.";
        //    }
        //    catch (Exception ex)
        //    {
        //        return ex.ToString();
        //    }
        //    finally
        //    {
        //        DataConnection.CloseConnection();
        //    }
        //}
        public static void UpdateFoodstuff(FoodStuff updatedFS)
        {
            //need some way of identifying the column without passing in the name itself which might change.
            //an enum won't work since that's just a bit of code associated with an integer.

            //TODO:
            //verify the record exists, if it does then update the designated column with the new value.

            //Potentially ugly hack to make this work is to just update every field regardless of whether they were
            //altered or not, overwriting with the same values for unaltered fields.
            //it might be slower but would save the headache of trying to pick and choose the fields we need to write to.
            try
            {
                //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
                //database will auto-default to NULL for the rest.
                string query = "update foodstuff set "; //these two must always be there

                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = conn;
               //if statements for each value to add, and its associated parameter
                query += "Name = ? ";
                cmd.Parameters.Add("?", OleDbType.VarChar).Value = updatedFS.Name;
                int intParameterCount = 1;
                if (updatedFS.Directions != "")
                {
                    query += ", Directions = ?";
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = updatedFS.Directions;
                    intParameterCount++;
                }
                if (updatedFS.PrepTime > -1) //use -1, items may still have 0 prep time
                {
                    query += ", PrepTime = ?";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.PrepTime;
                    intParameterCount++;
                }
                if (updatedFS.CookTime > -1)
                {
                    query += ", CookTime = ? ";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.CookTime;
                    intParameterCount++;
                }
                if (updatedFS.Cost > 0.0) //unlikely anything is going to be free
                {
                    query += ", Cost = ? ";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.Cost;
                    intParameterCount++;
                }
                if (updatedFS.Servings > 0)
                {
                    query += ", Servings = ?";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.Servings;
                    intParameterCount++;
                }
                if (updatedFS.GetTags() != "")
                {
                    query += ", Tags = ? ";
                    //Comma-and-space delineated list of the tags.
                    //When tokenizing or splitting tags, use ", " for the demarcation.
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = updatedFS.GetTags();
                    intParameterCount++;
                }
                query += "where FoodstuffID = ?";
                cmd.Parameters.Add("?",OleDbType.VarChar).Value = updatedFS.ID;

                cmd.CommandText = query;
                DataConnection.OpenConnection();

                cmd.ExecuteNonQuery();

                //item in fs's list isn't in ingredient list, so make (another) list of things we need to remove
                //and do the exact opposite for those ingredients we need to add new entries for.
                List<Recipe> IngredientsToDelete = new List<Recipe>();
                List<Recipe> IngredientsToAdd = new List<Recipe>();

                foreach (Recipe old_r in GetFoodstuffWithID(updatedFS.ID).ReturnIngredientsList())
                {
                    //needs to match at least one item
                    bool match = false;
                    foreach (Recipe new_r in updatedFS.ReturnIngredientsList())
                        if (old_r == new_r)
                            match = true;

                    if (!match)
                        IngredientsToDelete.Add(old_r);
                }

                foreach (Recipe new_r in updatedFS.ReturnIngredientsList())
                {
                    bool match = false;
                    foreach (Recipe old_r in GetFoodstuffWithID(updatedFS.ID).ReturnIngredientsList())
                        if (new_r == old_r)
                            match = true;

                    if(!match)
                        IngredientsToAdd.Add(new_r);
                }

                if (IngredientsToDelete.Count > 0)
                    foreach (Recipe r in IngredientsToDelete)
                        DeleteRecipeMaterial(r);

                if (IngredientsToAdd.Count > 0)
                    foreach (Recipe r in IngredientsToAdd)
                    {
                        AddRecipeItem(r);
                    }

            }
            catch (Exception ex)
            {
                //return ex.ToString();
            }
            finally
            {
                DataConnection.CloseConnection();
            }
        }
        //functions to read from, update in, and add to the database

        //
        //========================================================
        public static string AddFoodStuff(FoodStuff fs)
        {
            //insert a foodstuff entry in the Foodstuff table
            //will use comma-delineated string for the tags
            //now contains the ingredients itself, don't need to handle them separately
            try
            {
                //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
                //database will auto-default to NULL for the rest.
                string query = "insert into Foodstuff(FoodstuffID, Name"; //these two must always be there

                DataConnection.OpenConnection();
                OleDbDataReader rdItemCount = new OleDbCommand("Select Count(Name) from Foodstuff", conn).ExecuteReader();
                rdItemCount.Read();
                DataConnection.CloseConnection();

                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = conn;

                //if statements for each value to add, and its associated parameter
                cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.ID;// +Convert.ToInt32(rdItemCount[0]).ToString("0000#");
                cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Name;
                int intParameterCount = 2;
                if (fs.Directions != "")
                {
                    query += ", Directions";
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Directions;
                    intParameterCount++;
                }
                if (fs.PrepTime > -1) //use -1, items may still have 0 prep time
                {
                    query += ", PrepTime";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.PrepTime;
                    intParameterCount++;
                }
                if (fs.CookTime > -1)
                {
                    query += ", CookTime";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.CookTime;
                    intParameterCount++;
                }
                if (fs.Cost > 0.0) //unlikely anything is going to be free
                {
                    query += ", Cost";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Cost;
                    intParameterCount++;
                }
                if (fs.Servings > 0)
                {
                    query += ", Servings";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Servings;
                    intParameterCount++;
                }
                if (fs.GetTags() != "")
                {
                    query += ", Tags";
                    //Comma-and-space delineated list of the tags.
                    //When tokenizing or splitting tags, use ", " for the demarcation.
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.GetTags();
                    intParameterCount++;
                }
                query += ") Values(?";
                for (int i = 0; i < intParameterCount - 1; i++)
                {
                    query += ",?";
                }
                query += ")";

                cmd.CommandText = query;
                DataConnection.OpenConnection();

                cmd.ExecuteNonQuery();

                foreach (Recipe r in fs.ReturnIngredientsList())
                {
                    AddRecipeItem(r);
                }

                return("Item plus ingredients added.");
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
            finally
            {
                DataConnection.CloseConnection();
            }
        }
        private static int intMaintenanceCounter; //load this from the settings file? utility table?  registry? (ack!)

        #endregion Fields

        #region Methods

        //functions to read from, update in, and add to the database
        //
        //========================================================
        public static string AddFoodStuff(FoodStuff fs)
        {
            //insert a foodstuff entry in the Foodstuff table
            //will use comma-delineated string for the tags
            //now contains the ingredients itself, don't need to handle them separately
            try
            {
                //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
                //database will auto-default to NULL for the rest.
                string query = "insert into Foodstuff(FoodstuffID, Name"; //these two must always be there

                DataConnection.OpenConnection();
                OleDbDataReader rdItemCount = new OleDbCommand("Select Count(Name) from Foodstuff", conn).ExecuteReader();
                rdItemCount.Read();
                DataConnection.CloseConnection();

                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = conn;

                //if statements for each value to add, and its associated parameter
                cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.ID;// +Convert.ToInt32(rdItemCount[0]).ToString("0000#");
                cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Name;
                int intParameterCount = 2;
                if (fs.Directions != "")
                {
                    query += ", Directions";
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Directions;
                    intParameterCount++;
                }
                if (fs.PrepTime > -1) //use -1, items may still have 0 prep time
                {
                    query += ", PrepTime";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.PrepTime;
                    intParameterCount++;
                }
                if (fs.CookTime > -1)
                {
                    query += ", CookTime";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.CookTime;
                    intParameterCount++;
                }
                if (fs.Cost > 0.0) //unlikely anything is going to be free
                {
                    query += ", Cost";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Cost;
                    intParameterCount++;
                }
                if (fs.Servings > 0)
                {
                    query += ", Servings";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Servings;
                    intParameterCount++;
                }
                if (fs.GetTags() != "")
                {
                    query += ", Tags";
                    //Comma-and-space delineated list of the tags.
                    //When tokenizing or splitting tags, use ", " for the demarcation.
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.GetTags();
                    intParameterCount++;
                }
                query += ") Values(?";
                for (int i = 0; i < intParameterCount - 1; i++)
                {
                    query += ",?";
                }
                query += ")";

                cmd.CommandText = query;
                DataConnection.OpenConnection();

                cmd.ExecuteNonQuery();

                foreach (Recipe r in fs.ReturnIngredientsList())
                    AddRecipeItem(r);

                return "Item plus ingredients added.";
            }
            catch (Exception ex)
            {
                return ex.ToString();
            }
            finally
            {
                DataConnection.CloseConnection();
            }
        }
        //========================================================
        //

        //public static string AddFoodStuff(FoodStuff fs, List<Recipe> ingredients)
        //{
        //    //insert a foodstuff entry in the Foodstuff table
        //    //will use comma-delineated string for the tags
        //    try
        //    {
        //        //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
        //        //database will auto-default to NULL for the rest.
        //        string query = "insert into Foodstuff(FoodstuffID, Name"; //these two must always be there

        //        DataConnection.OpenConnection();
        //        OleDbDataReader rdItemCount = new OleDbCommand("Select Count(Name) from Foodstuff", conn).ExecuteReader();
        //        rdItemCount.Read();
        //        DataConnection.CloseConnection();

        //        OleDbCommand cmd = new OleDbCommand();
        //        cmd.Connection = conn;

        //        //if statements for each value to add, and its associated parameter
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.ID;// +Convert.ToInt32(rdItemCount[0]).ToString("0000#");
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Name;
        //        int intParameterCount = 2;
        //        if (fs.Directions != "")
        //        {
        //            query += ", Directions";
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Directions;
        //            intParameterCount++;
        //        }
        //        if (fs.PrepTime > -1) //use -1, items may still have 0 prep time
        //        {
        //            query += ", PrepTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.PrepTime;
        //            intParameterCount++;
        //        }
        //        if (fs.CookTime > -1)
        //        {
        //            query += ", CookTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.CookTime;
        //            intParameterCount++;
        //        }
        //        if (fs.Cost > 0.0) //unlikely anything is going to be free
        //        {
        //            query += ", Cost";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Cost;
        //            intParameterCount++;
        //        }
        //        if (fs.Servings > 0)
        //        {
        //            query += ", Servings";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Servings;
        //            intParameterCount++;
        //        }
        //        if (fs.GetTags() != "")
        //        {
        //            query += ", Tags";
        //            //Comma-and-space delineated list of the tags.
        //            //When tokenizing or splitting tags, use ", " for the demarcation.
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.GetTags();
        //            intParameterCount++;
        //        }
        //        query += ") Values(?";
        //        for (int i = 0; i < intParameterCount-1; i++)
        //        {
        //            query += ",?";
        //        }
        //        query += ")";

        //        cmd.CommandText = query;
        //        DataConnection.OpenConnection();

        //        cmd.ExecuteNonQuery();

        //        foreach (Recipe r in ingredients)
        //            AddRecipeItem(r);

        //        return "Item plus ingredients added.";
        //    }
        //    catch (Exception ex)
        //    {
        //        return ex.ToString();
        //    }
        //    finally
        //    {
        //        DataConnection.CloseConnection();
        //    }
        //}

        //public static string AddFoodStuff(FoodStuff fs, Recipe r)
        //{
        //    //same as other but for just adding single Recipe elements instead of from a list.
        //    //insert a foodstuff entry in the Foodstuff table
        //    //will use comma-delineated string for the tags
        //    try
        //    {
        //        //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
        //        //database will auto-default to NULL for the rest.
        //        string query = "insert into Foodstuff(FoodstuffID, Name"; //these two must always be there

        //        OleDbDataReader rdItemCount = new OleDbCommand("Select Count(Name) from Foodstuff", conn).ExecuteReader();
        //        rdItemCount.Read();

        //        OleDbCommand cmd = new OleDbCommand();
        //        cmd.Connection = conn;
        //        //fs.ID += Convert.ToInt32(rdItemCount[0]).ToString("0000#");
        //        //if statements for each value to add, and its associated parameter
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.ID;// +Convert.ToInt32(rdItemCount[0]).ToString("0000#");
        //        cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Name;
        //        int intParameterCount = 2;
        //        if (fs.Directions != "")
        //        {
        //            query += ", Directions";
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.Directions;
        //            intParameterCount++;
        //        }
        //        if (fs.PrepTime > -1) //use -1, items may still have 0 prep time
        //        {
        //            query += ", PrepTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.PrepTime;
        //            intParameterCount++;
        //        }
        //        if (fs.CookTime > -1)
        //        {
        //            query += ", CookTime";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.CookTime;
        //            intParameterCount++;
        //        }
        //        if (fs.Cost > 0.0) //unlikely anything is going to be free
        //        {
        //            query += ", Cost";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Cost;
        //            intParameterCount++;
        //        }
        //        if (fs.Servings > 0)
        //        {
        //            query += ", Servings";
        //            cmd.Parameters.Add("?", OleDbType.Numeric).Value = fs.Servings;
        //            intParameterCount++;
        //        }
        //        if (fs.GetTags() != "")
        //        {
        //            query += ", Tags";
        //            //Comma-and-space delineated list of the tags.
        //            //When tokenizing or splitting tags, use ", " for the demarcation.
        //            cmd.Parameters.Add("?", OleDbType.VarChar).Value = fs.GetTags();
        //            intParameterCount++;
        //        }
        //        query += ") Values(?";
        //        for (int i = 1; i < intParameterCount; i++) //counter is one-based
        //        {
        //            query += ",?";
        //        }
        //        query += ")";

        //        cmd.CommandText = query;
        //        AddRecipeItem(r);
        //        DataConnection.OpenConnection();

        //        cmd.ExecuteNonQuery();


        //        return "Item plus ingredients added.";
        //    }
        //    catch (Exception ex)
        //    {
        //        return ex.ToString();
        //    }
        //    finally
        //    {
        //        DataConnection.CloseConnection();
        //    }
        //}

        public static void UpdateFoodstuff(FoodStuff updatedFS)
        {
            //need some way of identifying the column without passing in the name itself which might change.
            //an enum won't work since that's just a bit of code associated with an integer.

            //TODO:
            //verify the record exists, if it does then update the designated column with the new value.

            //Potentially ugly hack to make this work is to just update every field regardless of whether they were
            //altered or not, overwriting with the same values for unaltered fields.
            //it might be slower but would save the headache of trying to pick and choose the fields we need to write to.
            try
            {
                //this needs to be rewritten to only insert fields and parameters for the items that the user is inserting, so the
                //database will auto-default to NULL for the rest.
                string query = "update foodstuff set "; //these two must always be there

                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = conn;
                //if statements for each value to add, and its associated parameter
                query += "Name = ? ";
                cmd.Parameters.Add("?", OleDbType.VarChar).Value = updatedFS.Name;
                int intParameterCount = 1;
                if (updatedFS.Directions != "")
                {
                    query += ", Directions = ?";
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = updatedFS.Directions;
                    intParameterCount++;
                }
                if (updatedFS.PrepTime > -1) //use -1, items may still have 0 prep time
                {
                    query += ", PrepTime = ?";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.PrepTime;
                    intParameterCount++;
                }
                if (updatedFS.CookTime > -1)
                {
                    query += ", CookTime = ? ";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.CookTime;
                    intParameterCount++;
                }
                if (updatedFS.Cost > 0.0) //unlikely anything is going to be free
                {
                    query += ", Cost = ? ";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.Cost;
                    intParameterCount++;
                }
                if (updatedFS.Servings > 0)
                {
                    query += ", Servings = ?";
                    cmd.Parameters.Add("?", OleDbType.Numeric).Value = updatedFS.Servings;
                    intParameterCount++;
                }
                if (updatedFS.GetTags() != "")
                {
                    query += ", Tags = ? ";
                    //Comma-and-space delineated list of the tags.
                    //When tokenizing or splitting tags, use ", " for the demarcation.
                    cmd.Parameters.Add("?", OleDbType.VarChar).Value = updatedFS.GetTags();
                    intParameterCount++;
                }
                query += "where FoodstuffID = ?";
                cmd.Parameters.Add("?", OleDbType.VarChar).Value = updatedFS.ID;

                cmd.CommandText = query;
                DataConnection.OpenConnection();

                cmd.ExecuteNonQuery();

                //item in fs's list isn't in ingredient list, so make (another) list of things we need to remove
                //and do the exact opposite for those ingredients we need to add new entries for.
                List <Recipe> IngredientsToDelete = new List <Recipe>();
                List <Recipe> IngredientsToAdd    = new List <Recipe>();

                foreach (Recipe old_r in GetFoodstuffWithID(updatedFS.ID).ReturnIngredientsList())
                {
                    //needs to match at least one item
                    bool match = false;
                    foreach (Recipe new_r in updatedFS.ReturnIngredientsList())
                    {
                        if (old_r == new_r)
                        {
                            match = true;
                        }
                    }

                    if (!match)
                    {
                        IngredientsToDelete.Add(old_r);
                    }
                }

                foreach (Recipe new_r in updatedFS.ReturnIngredientsList())
                {
                    bool match = false;
                    foreach (Recipe old_r in GetFoodstuffWithID(updatedFS.ID).ReturnIngredientsList())
                    {
                        if (new_r == old_r)
                        {
                            match = true;
                        }
                    }

                    if (!match)
                    {
                        IngredientsToAdd.Add(new_r);
                    }
                }

                if (IngredientsToDelete.Count > 0)
                {
                    foreach (Recipe r in IngredientsToDelete)
                    {
                        DeleteRecipeMaterial(r);
                    }
                }

                if (IngredientsToAdd.Count > 0)
                {
                    foreach (Recipe r in IngredientsToAdd)
                    {
                        AddRecipeItem(r);
                    }
                }
            }
            catch (Exception ex)
            {
                //return ex.ToString();
            }
            finally
            {
                DataConnection.CloseConnection();
            }
        }