不知道这样写错在哪里
sql="select * from t_news where ID in("&
for i=0 to ubound(aa)
response.write aa(i)&","
next
&")"
不得已才想到这样写,但有语法错误,aa是一个数组,我试了一下,只有把aa里的值一个一个列出来才能放到sql语句的in里面去,但不列出来又出错,不知道应该怎样解决呢?
问题点数:50、回复次数:4Top
1 楼zlp321002(Life Is Good,Let's Shine)回复于 2005-11-16 09:52:46 得分 17
--SQL 不支持数组,这样做
declare @a varchar(10)
set @a='1,2,3'
select * from 表
where charindex(','+cast(id varchar)+',',','+@a+',')>0Top
2 楼zlp321002(Life Is Good,Let's Shine)回复于 2005-11-16 09:54:31 得分 17
--晕。掉了个as
select * from 表
where charindex(','+cast(id as varchar)+',',','+@a+',')>0
Top
3 楼rivery(river)回复于 2005-11-16 09:58:44 得分 16
把a(i)数组的内容组织为字符串如:"1,2,3"
然后直接使用:
sql="select * from t_news where ID in("&字符串&")"
Top
4 楼wangbo_wb()回复于 2005-11-16 10:22:42 得分 0
收到Top




