~~~
UserTab user = new UserTab();
OQL deleteQ = OQL.From(user)
.Delete()
.Where(cmp => cmp.Comparer(user.UserID, OQLCompare.CompareType.Equal, 2))
.END;
EntityQuery<UserTab>.Instance.ExecuteOql(deleteQ);
~~~
**为了安全,不带Where条件是不会全部删除数据的**
上面执行到数据库的时候等同下面sql语句的执行:
`DELETE FROM [UserTab] WHERE [UserID] = 2`
以上也可以写成下面的方式:
~~~
UserTab user = new UserTab() { UserID = 2 };
OQL deleteQ1 = OQL.From(user)
.Delete()
.Where(user.UserID) //这里等同于 UserID=@UserID
.END;
EntityQuery<UserTab>.Instance.ExecuteOql(deleteQ1);
~~~