日期:2014-05-18  浏览次数:20560 次

为什么这个循环只出双数???
<%
dim   Counter,UserID,UserName,UserID2,UserName2,Rs1,Rs2,Rs3
'只处理TopicID段内的主题
For   Counter=4920   to   4938

Set   Rs1=Dvbbs.Execute( "Select   TopicID   From   Dv_Topic   Where   TopicID= "&Counter& " ")
if   not   Rs1.eof   then
'把楼主也就是提问者随机改成不包含以下几位会员
Set   Rs2=Dvbbs.Execute( "Select   UserID,UserName   From   Dv_User   Where   UserID <> '104 '   and   UserID <> '852 '   and   UserID <> '11 '   order   by   NEWID() ")
UserID=Rs2(0)
UserName=Rs2(1)
'把回复者也就是提问者随机改成以下几位会员
Set   Rs3=Dvbbs.Execute( "Select   Top   1   UserID,UserName   From   Dv_User   Where   UserID= '104 '   or   UserID= '852 '   or   UserID= '11 '   order   by   NEWID() ")
UserID2=Rs3(0)
UserName2=Rs3(1)

'修改楼主用户名和ID,Dv_Topic表和Dv_bbs1表
Dvbbs.Execute( "Update   Dv_Topic   Set   PostUsername= ' "&UserName& " ',PostUserid= "&UserID& "   Where   TopicID= "&Counter& " ")
Dvbbs.Execute( "Update   Dv_bbs1   Set   Username= ' "&UserName& " ',PostUserid= "&UserID& "   Where   ParentID=0   and   RootID= "&Counter& " ")
'修改回复者
Dvbbs.Execute( "Update   Dv_bbs1   Set   Username= ' "&UserName2& " ',PostUserid= "&UserID2& "   Where   ParentID <> 0   and   RootID= "&Counter& " ")
end   if
Response.Write   Rs1(0)   &   "   OK <br> " '打印处理结果

Counter=Counter+1
Next
%>
这是结果:
4920   OK
4922   OK
4924   OK
4926   OK
4928   OK
4930   OK
4932   OK
4934   OK
4936   OK
4938   OK

数据库里有单数的呀,为什么????

------解决方案--------------------
Counter=Counter+1
把这句去掉 ,next 已经表示加1了