注册 登录
编程论坛 ASP技术论坛

ASPdo while 循环除了写 rs.eof or rs.bof循环还能不能写一个数不等于另个数实行循环类试的这些条件

夜龙魂 发布于 2009-11-03 13:17, 1199 次点击
ASP
do while 循环除了写 rs.eof or rs.bof
这些条件外能不能写一个数不等于另个数实行循环类试的这些条件

比如数据库有5条数据我用rs.eof他会循环5次
我想让他循环3次的时候就停止或者当数据库到了XX字段
的时候停止

[ 本帖最后由 夜龙魂 于 2009-11-3 13:24 编辑 ]
3 回复
#2
chenbofeng202009-11-03 13:49
用for 循环
if not rs.eof then '不为空时才能用for
for i = 1 to 3
rs.movenext
if rs.eof then exit for '记录不够3条时 循环跳出
next
end if
#3
chenguoxing5172009-11-03 17:47
不如直接在sql语句中指定读前几条
#4
msgj2009-11-03 23:26
Do While Adodc1.Recordset.Fields(0) <> "cccc"
......

Loop
1