用VBscript来写数组的问题。很急。在线等带。
dim icount
dim chkarray=new array()
if request("auser")>"" then
chkarray=split(request("auser"),",")
for icount=0 to ubound(chkarray)
sql=sql+" select * from table where name="&chkarrayp[icount]&"
next
rs.open sql,conn,1,3
end if
请问我这样写哪儿有错呀。请各位帮帮我。
我的request("auser")取出的是一些字符直,有很多的。
谢谢各位了。
推荐阅读
dim icount
dim chkarray=new array()
if request("auser") <> "" then
chkarray=split(request("auser"),",")
sql = "select * from table where name in ("
for icount=0 to ubound(chkarray)
sql = sql+ "" & chkarray(icount) & ""
if icount <> ubound(chkarray) then
sql = sql + ","
end if
next
sql = sql + ")"
rs.open sql,conn,1,3
....
end if
不要把 select ... from ... 也写进去,你这样写生成了
select ... from ...select ... from ...select ... from ...select ... from ...
按楼上的做即可。
同意。
dim icount
dim chkarray=new array(3)
if request("auser") <> "" then
chkarray=split(request("auser"),",")
sql = "select * from table where name in ("
for icount=0 to ubound(chkarray)
sql = sql+ "" & chkarray(icount) & ""
if icount <> ubound(chkarray) then
sql = sql + ","
end if
next
sql = sql + ")"
rs.open sql,conn,1,3
....
end if
vbscript中没有new array()这种用法...
把这句改成
dim chkarray=new array()==>dim chkarray
同意楼上 up
javascript才会var aaa=new array(),
vbscript 定义数组是dim aaa(3),
或dim aaa()
redim aaa(3)
多此一举吧~~这样
dim icount
dim chkarray()
if request("auser") <> "" then
sql = "select * from table where name in ("&request("auser")&")"
rs.open sql,conn,1,3
end if
dim icount
if request("auser") <> "" then
sql = "select * from table where name in ("&request("auser")&")"
rs.open sql,conn,1,3
end if
if request("auser") <> "" then
sql = "select * from table where name in ("&request("auser")&")"
rs.open sql,conn,1,3
end if
同意:
回复人: summercat(飘轩) ( ) 信誉:110 2003-08-15 10:18:00 得分:0
if request("auser") <> "" then
sql = "select * from table where name in ("&request("auser")&")"
rs.open sql,conn,1,3
end if
dim icount
dim chkarray
if request("auser") <> "" then
chkarray=split(request("auser"),",")
sql = "select * from table where name in ("
for icount=0 to ubound(chkarray)-1
sql = sql+ "" & chkarray(icount) & ""
if icount <> ubound(chkarray) then
sql = sql + ","
end if
next
sql = sql + ")"
rs.open sql,conn,1,3
....
end if


讨论区