SELECT distinct id,  senddate,unitRange  FROM supervise_aviso 
 where id in ('"+ss+"') order by senddate desc括号里面多了'
改为:SELECT distinct id,  senddate,unitRange  FROM supervise_aviso 
 where id in ("+ss+") order by senddate desc

解决方案 »

  1.   

    SELECT distinct id,  senddate,unitRange  FROM supervise_aviso 
     where   id in ("+ss+") order by senddate desc;
    这样写就可以了
      

  2.   

    declare @ss nvarchar(100)set @ss='1,2,3,4,5,6'exec('SELECT distinct id,senddate,unitRange FROM supervise_aviso 
    where id  in ('+@ss+') order by senddate desc')
      

  3.   

    "SELECT distinct id,senddate,unitRange FROM supervise_aviso where id in("+ss+") order by senddate desc"