示例#1
0
 public int Update(IModel mode, ValuePair val, Condition condition)
 {
     string op = "";
     return Update(mode, val, condition, out op);
 }
示例#2
0
        public int Update(IModel mode, ValuePair val, Condition condition, out string opguid)
        {
            var parms = new ParameterCollection();
            opguid = Guid.NewGuid().ToString();
            string valstr = val.ToString(mode, parms);
            if (!string.IsNullOrEmpty(valstr))
            {
                string condstr = condition.ToString(mode, parms);
                if (!string.IsNullOrEmpty(condstr))
                {
                    var p = DbEngine.Instance.NewDataParameter("lastchange_time");
                    p.Value = DateTime.Now;
                    parms.Add(p.ParameterName, p);

                    string sql = string.Format("update {0} set {1},op_guid='{2}',lastchange_time={3} where {4}"
                        , new string[] { mode.zTableName, valstr, opguid, p.ParameterName, condstr });
                    return DbEngine.Instance.ExecuteNonQuery(sql, parms.Values.ToArray());
                }
            }
            return 0;
        }