/// <summary> /// 更新一条数据 /// </summary> public static bool Update(ActivityMenu model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ActivityMenu set "); strSql.Append("ID=@ID,"); strSql.Append("ActivityID=@ActivityID,"); strSql.Append("MenuName=@MenuName,"); strSql.Append("MenuValue=@MenuValue,"); strSql.Append("Sort=@Sort,"); strSql.Append("Color=@Color"); strSql.Append(" where ID=@ID and ActivityID=@ActivityID and MenuName=@MenuName and MenuValue=@MenuValue and Sort=@Sort and Color=@Color "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@ActivityID", SqlDbType.Int, 4), new SqlParameter("@MenuName", SqlDbType.NVarChar, 50), new SqlParameter("@MenuValue", SqlDbType.NVarChar, 10), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@Color", SqlDbType.NVarChar, 30) }; parameters[0].Value = model.ID; parameters[1].Value = model.ActivityID; parameters[2].Value = model.MenuName; parameters[3].Value = model.MenuValue; parameters[4].Value = model.Sort; parameters[5].Value = model.Color; using (var db = DbHelper.CreateDefaultDbHelper()) { SqlCommand cmd = new SqlCommand(strSql.ToString()); cmd.CommandType = CommandType.Text; cmd.Parameters.AddRange(parameters); return(db.ExecuteNonQuery(cmd) > 0); } }
public static bool Update(ActivityMenu model) { return(DALActivityMenu.Update(model)); }
void Awake() { instance = this; }