/// <summary> /// Allows the programmer to easily update rows in the DB. /// </summary> /// <param name="tableName">The table to update.</param> /// <param name="data">A dictionary containing Column names and their new values.</param> /// <param name="whereCase">The where clause for the update statement.</param> /// <returns>A boolean true or false to signify success or failure.</returns> public void Update(string tableName, Dictionary<string, string> data, string whereCase) { string vals = string.Empty; if (data.Count > 0) { vals = data.Aggregate(vals, (current, val) => String.Format("{0} {1} = '{2}',", current, val.Key, val.Value)); vals = vals.Substring(0, vals.Length - 1); } ExecuteNonQuery(String.Format("update {0} set {1} where {2};", tableName, vals, whereCase)); }