日期:2014-05-17  浏览次数:20558 次

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 + ")