for(int i=0;i string selectCommand="select dept from tablename where dept='"+deptlist[i]+"'"; 然后你去执行这个命令就可以拿到了}
string sql = "select * from tab where dept in {0}";string depts = deptlist.Aggregate((d,dd) => "'" + d + "','" + dd + "'");sql = sql.Formart(sql,depts);