各位大侠看看我的程序错误在哪里??

来源:百度知道 编辑:UC知道 时间:2024/05/05 12:15:22
<%
set rstext=server.createobject("adodb.recordset")
sqltext="select * from shop_fanxian order by id desc"
rstext.open sqltext,conn,1,1
%>
<table width="850" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" valign="top" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td height="24" align="left" valign="top">
<DIV class=t1>返现商店</DIV> </td>
</tr>
<tr>
<td align="left"><TABLE class=b1 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<%
if not rstext.eof the

你的代码不能这样写,在一个do while与loop循环中不要使用三次rstext.movenext,应该只使用一次才能保证不出现错误。你的页面之所以出现错误是因为数据库游标已经走到最后一条纪录了,而再次运行了rstext.movenext引起的,也就是说你的数据库表中的纪录数如果不是3的倍数,那么页面就会出错,如果是3的倍数,那么页面就不会报错。
下面是我帮你修改的代码:
<%
set rstext=server.createobject("adodb.recordset")
sqltext="select * from shop_fanxian order by id desc"
rstext.open sqltext,conn,1,1
%>
<table width="850" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" valign="top" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td height="24" align="left" valign="top">
<DIV class=t1>返现商店</DIV> </td>
</tr>
<tr>
<td align="left"><TABLE class=