当前位置: 代码迷 >> ASP.NET >> 数组作为数据库的查询条件解决思路
  详细解决方案

数组作为数据库的查询条件解决思路

热度:8548   发布时间:2013-02-25 00:00:00.0
数组作为数据库的查询条件
有一个字符串数组。如string[] dw={"机加分厂","修理分厂"}
怎么将数作为数据库的查询条件。



------解决方案--------------------------------------------------------
上面少了个,

我改了下代码如下

C# code
 string[] dw = { "机加分厂", "修理分厂", "修理分厂" };            string sqlwhere = string.Join("','",dw);            string sql = "select * from table where name in ('" + sqlwhere + "')";
  相关解决方案