在select中关于in的使用。
<%...........srt="12,23,45,67"sql="select * from table where id in('"&str&"')" '这样好像不行?...........%>--模拟数据表create table tablename(id int)insert into tablenameselect 12 union allselect 13 union allselect 14 union allselect 15 union allselect 16 union allselect 45 union allselect 46 union allselect 47declare @str varchar(14)set @str='12,23,45,67'exec('select * from tablename where id in ('+@str+')')/*id-----------1245*/
[解决办法]
declare @str varchar(14)set @str='12,23,45,67'select * from tablename where ltrim(id) in (@str)
[解决办法]
改成
<%
...........
srt="12,23,45,67"
sql="select * from table where id in("&str&")"
...........
%>
就可以了,不要单引号