3.22学习理解httpContext与where 1=1

Posted 寒夜美美

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了3.22学习理解httpContext与where 1=1相关的知识,希望对你有一定的参考价值。

1、HttpContext
HttpContext.Current.Session.RemoveAll();从会话状态集合中移除所有的键和值。(未过期,还存在)
HttpContext.Current.Session.Abandon();?//清空当前所有的Session (已过期)
2、where 1 = 1
where条件中1=1之后的条件是通过if块动态变化的。例如:
String sql="select * from table_name where 1=1";
if(conditon1)
    {
sql=sql+"andvar2=value2";
}
if(conditon2)
    {
sql=sql+"andvar3=value3";
}
where 1=1 是为了避免where 关键字后面的第一个词直接就是“and”而导致语法错误。1=1永真条件,一般用于构造动态SQL语句,"SELECT...FROM...WHERE 1=1"+动态构造条件子句。

以上是关于3.22学习理解httpContext与where 1=1的主要内容,如果未能解决你的问题,请参考以下文章

3.22 网页

Linq to sql where [column] in(值列表与其他架构)

曹虞:3.22 亏损单的形成与解决之道

3.22上

将索引与 where 和 join 子句一起使用

代码记录