当前位置: 代码迷 >> ASP.NET >> sql in 里面,如果字段是INT型,怎么处理
  详细解决方案

sql in 里面,如果字段是INT型,怎么处理

热度:2053   发布时间:2013-02-25 00:00:00.0
sql in 里面,如果字段是INT型,怎么办~
string departid = Session["depart"].ToString();
  departid = departid.Remove(departid.Length - 1, 1);
  string sql = "select * from depart_table where id in('" + departid + "')";



id为INT型,这怎么弄- -

------解决方案--------------------------------------------------------
id in(" + departid + ")"
---------->
id in(1,2,3,4,5)
------解决方案--------------------------------------------------------
slect * from xxx where id in (1,2,3,4,5),数字不加引号
------解决方案--------------------------------------------------------
id in(" + departid + ")
  相关解决方案