示例#1
0
        public static void 更新()
        {
            SODUser user = new SODUser();
            OQL     q    = OQL.From(user)
                           .Select()
                           .Where(cmp => cmp.Property(user.ID) == 4)
                           .END;
            SODUser updateUser = EntityQuery <SODUser> .QueryObject(q);

            updateUser.LogPwd = "111111111";

            //方式一
            int result = EntityQuery <SODUser> .Instance.Update(updateUser);


            ////方式二
            //EntityQuery<SODUser> eq = new EntityQuery<SODUser>(user);
            //            result= eq.SaveAllChanges();


            //方式三
            updateUser.LogPwd = "aaaaaaaa";
            OQL q2 = new OQL(updateUser);

            q2.Update(updateUser.LogPwd).Where(updateUser.ID);
            //结果大于0就成功
            result = EntityQuery <SODUser> .Instance.ExecuteOql(q2);
        }
示例#2
0
        static void UpdateTest()
        {
            LT_Users userCmp = new LT_Users()
            {
                Authority = "admin", IsEnable = true, Remarks = "add"
            };
            // LT_Users userQ = new LT_Users();
            //OQLCompare cmp = new OQLCompare(userCmp);
            //OQL q = new OQL(userQ);
            OQL        q   = new OQL(userCmp);
            OQLCompare cmp = new OQLCompare(q);

            cmp = cmp.Comparer(userCmp.ID, "in", new int[] { 1, 2, 3 })
                  & cmp.Comparer(userCmp.LastLoginIP, "=", "127.0.0.1");
            //------分界线-------

            q.Update(userCmp.Authority, userCmp.IsEnable, userCmp.Remarks).Where(cmp);

            Console.WriteLine("update test:{0}\r\n{1}", q, q.PrintParameterInfo());
        }