条款在何处 [英] IN Clause in Where Condition

查看:66
本文介绍了条款在何处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否有办法像这样在IN语句中传递空值.

Hi,

Is there a way to pass null values in the IN statement, like this.

select * from Table where Table.id IN (,1,2,,,)


当我单击表单中的某些复选框时,IN语句中的值就会出现.


The values in the IN statment comes when i click some checkbox in forms.

推荐答案

select * 
from 
Table 
where Table.id is null
or Table.id IN (1,2)


像这样尝试

try like this

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  {
      SqlDataAdapter da = new SqlDataAdapter("select * from student where stid in('',1,2)", con);
      DataSet ds = new DataSet();
      da.Fill(ds);

      GridView1.DataSource = ds;
      GridView1.DataBind();
  }


这篇关于条款在何处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆