| 发表于:2007-04-06 10:32:04 楼主 |
请大家看一段代码片段: with cmd .activeconnection = cnn .commandtimeout = 30 .commandtype = adcmdtext .commandtext = "select * from a " set rst = .EXECute end with if not (rst.eof and rst.bof) then rst.movefirst do while not rst.eof detail = " " title = " " user_id = rst.fields(0) title = trim(rst.fields(1)) mo = " " do while rst.fields(0) = user_id detail = detail + trim(rst.fields(2)) mo = rst.fields(2) do while rst.fields(2) = mo detail = detail + trim(rst.fields(3)) rst.movenext loop loop detail = title + chr(13) + detail loop end if 下面是我的数据范例 aaa b c d aaa bb cc dd aaa bbb cc dd bbb b c d bbb bb c d bbb bbb cc dd ccc b c d ccc b c dd 我对循环的最初设想是这样的: 1)先判断rst是否为eof,如果不是,继续循环 2)判断rst.fields(0)是否相同,如果相同,在同一循环,否则进入下一循环 3)判断rst.fields(2)是否相同,如果相同,在同一循环,否则进入下一循环 现在的问题是前面的几次循环是正常的,但到了最后一次循环,也就是rst.fields(0)=ccc时,其实当时rst已经到了eof,我的整个循环应该结束,但是程序进入了死循环,无法跳出,请高手指点原因。 |
|
|
|
|