ASP的for 循环问题 if instr(ID,",")>0 then
dim idarr,i
idArr=split(ID) 'ID数组
for i = 0 to ubound(idArr)
'call DelNews(clng(idarr(i)))
sqltel="select * from student where ID=" & clng(idarr(i))
Set rstel= Server.CreateObject("ADODB.Recordset")
rstel.open sqltel,conn,1,3
phone = rstel("phione")'得到电话
phone = phone&","
response.write phone
next
else
'call DelNews(clng(ID)) 'ID
end if
if instr(ID,",")>0 then
dim idarr,i,phone
phone=""
idArr=split(ID) 'ID数组
for i = 0 to ubound(idArr)
'call DelNews(clng(idarr(i)))
sqltel="select * from student where ID=" & clng(idarr(i))
Set rstel= Server.CreateObject("ADODB.Recordset")
rstel.open sqltel,conn,1,3
if phone="" then
phone = rstel("phione")'得到电话
else
phone = phone&","&rstel("phione")
response.write phone
end if
next
else
'call DelNews(clng(ID)) 'ID
end if
------解决方案-------------------- '笨办法一个
dim peo:peo=len(phone)
if peo>5 and right(phone,1)="," then
phone=left(phone,peo-1)
end if
response.write(phone)