public static string UPDATE_stm(string table, SQLField whereID, params SQLField[] fields) { string sql = String.Empty; string sql1 = string.Empty; if (fields.Length > 0) { for (int i = 0; i < fields.Length; i++) { sql1 += (string.IsNullOrEmpty(sql1) ? "" : ",") + string.Format("{0}={1}", fields[i].Name, fields[i].SQLValue); } string sql2 = string.Empty; if (whereID != null) { sql2 = " WHERE " + string.Format("{0}={1}", whereID.Name, whereID.SQLValue); } if (SafeMode && whereID == null) { return(string.Empty); } sql = string.Format("UPDATE {0} SET {1}{2} ", table, sql1, sql2); } return(sql); }
public static string DELETE_stm(string table, SQLField whereID) { string sql = String.Empty; string sql1 = string.Empty; if (whereID != null) { sql1 = " WHERE " + string.Format("{0}={1}", whereID.Name, whereID.SQLValue); } if (SafeMode && whereID == null) { return(string.Empty); } sql = string.Format("DELETE {0} {1} ", table, sql1); return(sql); }