while not rss.eof 问题 BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

h3214712 2009-12-21 11:08:53
<form name="nrg" method="post" action="">
<table cellpadding="0" cellspacing="0" border="0" width="680">
<tr>
<td width="20%">管理文件归属:</td>
<td align="left" width="80%" colspan="2"><select name="suoshu" style="width:150px; " onchange="javascript:location.href='?al='+document.nrg.suoshu.options[document.nrg.suoshu.selectedIndex].value" >
<% al=request("al")
set rs=server.CreateObject("adodb.recordset")
sql="select* from xinxi where suoshu='"&al&"' order by id desc "
rs.open sql,conn,1,1
if rs.eof then %>
<option value="--">请选择</option>
<option value="作品">作品</option>
<option value="日志">日志</option>
<option value="学习">学习</option>
<option value="简介">简介</option>
<% Else %>
<option value="<%= rs("suoshu") %>"><%= rs("suoshu") %></option>
<% rs.close
End If
%>
</select></td>
</tr>
<tr>
<td style="font-size:24px; color:#999999; font-weight:bold" colspan="3"><% If al="" Then %>请先选择管理文件归属.<% Else %><%= al %>管理<% End If%></td>
</tr>
<tr bgcolor="#FFFFCC">
<td width="20%">fig-类型</td>
<td width="45%">标题</td>
<td width="35%">info-上传</tr>
<% al=request("al")
if al <>"" then
set rss=server.CreateObject("adodb.recordset")
sqle="select * from xinxi where suoshu='"&al&"' order by id desc "
rss.open sqle,conn,1,1
dim fys
fys="xinxi"

while not rss.eof '这里的问题。没有就能显示1条记录

%>
<tr>
<td width="20%"><%= rss("fig") %></td>
<td width="45%" ><font title="<%= rss("biaoti") %>" style="cursor:hand; "><%= left(rss("biaoti"),30) %></font></td>
<td width="35%"><font title="<%= rss("info") %>" style="cursor:hand; "><%= left(rss("info"),20) %></font></td>
</tr>
<% rss.movenext
wend
else%>
<tr>
<td width="20%">请先选择管理文件归属.</td>
<td width="45%" >请先选择管理文件归属.</td>
<td width="35%">请先选择管理文件归属.</td
></tr>
<% End If %>
<tr>
</tr>
<tr>
<td colspan="3" ><% If al="" Then %>请先选择管理文件归属.<% Else %><input type="button" onClick="dile('<%=rss("id")%>','<%= fys %>')" name="an" value="修改"><input type="button" onclick="javascript:location.href='inc/shanch.asp?id=<%=rss("id")%>&gg=1'" name="an1" value="删除"><% End If%></td>
</tr>
</table>
</form>





//数据库连接绝对没问题。加了 while not rss.eof 循环才出现问题
没加 能显示一条记录





...全文
128 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
yan11cn 2009-12-21
  • 打赏
  • 举报
回复
没看出来啥问题。。
gxq323 2009-12-21
  • 打赏
  • 举报
回复
while not rss.eof
改成
while rss.recordcount>0
h3214712 2009-12-21
  • 打赏
  • 举报
回复
是不是 不是循环错误。。。是别的地方出了错


<form name="nrg" method="post" action="">
<table cellpadding="0" cellspacing="0" border="0" width="680">
<tr>
<td width="20%">管理文件归属:</td>
<td align="left" width="80%" colspan="2"><select name="suoshu" style="width:150px; " onchange="javascript:location.href='?al='+document.nrg.suoshu.options[document.nrg.suoshu.selectedIndex].value" >
<% al=request("al")
set rs=server.CreateObject("adodb.recordset")
sql="select* from xinxi where suoshu='"&al&"' order by id desc "
rs.open sql,conn,1,1
if rs.eof then
dim fys
fys="xinxi" %>
<option value="--">请选择</option>
<option value="作品">作品</option>
<option value="日志">日志</option>
<option value="学习">学习</option>
<option value="简介">简介</option>
<% Else %>
<option value="<%= rs("suoshu") %>"><%= rs("suoshu") %></option>
<%End If%>
</select></td>
</tr>
<tr>
<td style="font-size:24px; color:#999999; font-weight:bold" colspan="3"><% If al="" Then %>请先选择管理文件归属.<% Else %><%= al %>管理<% End If%></td>
</tr>
<tr bgcolor="#FFFFCC">
<td width="20%">fig-类型</td>
<td width="45%">标题</td>
<td width="35%">info-上传</tr>
<%
if al <>"" then

while not rs.eof '这里的问题。没有就能显示1条记录
'while rs.recordcount>0 '也不行
%>
<tr>
<td width="20%"><%= rs("fig") %></td>
<td width="45%" ><font title="<%= rs("biaoti") %>" style="cursor:hand; "><%= left(rs("biaoti"),30) %></font></td>
<td width="35%"><font title="<%= rs("info") %>" style="cursor:hand; "><%= left(rs("info"),20) %></font></td>
</tr>
<% rs.movenext
wend
else%>
<tr>
<td width="20%">请先选择管理文件归属.</td>
<td width="45%" >请先选择管理文件归属.</td>
<td width="35%">请先选择管理文件归属.</td
></tr>
<% End If %>
<tr>
</tr>
<tr>
<td colspan="3" ><% If al="" Then %>请先选择管理文件归属.<% Else %><input type="button" onClick="dile('<%=rs("id")%>','<%= fys %>')" name="an" value="修改"><input type="button" onclick="javascript:location.href='inc/shanch.asp?id=<%=rs("id")%>&gg=1'" name="an1" value="删除"><% End If%></td>
</tr>
</table>
</form>

h3214712 2009-12-21
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 pig510520 的回复:]
if not rss.eof then
  while not rss.eof
  *
  *
  *
else
******
end if
[/Quote]


<%
if al <>"" then

while not rs.eof '这里的问题。没有就能显示1条记录
'while rs.recordcount>0 '也不行
%>
<tr>
<td width="20%"><%= rs("fig") %></td>
<td width="45%" ><font title="<%= rs("biaoti") %>" style="cursor:hand; "><%= left(rs("biaoti"),30) %></font></td>
<td width="35%"><font title="<%= rs("info") %>" style="cursor:hand; "><%= left(rs("info"),20) %></font></td>
</tr>
<% rs.movenext
wend
else%>
<tr>
<td width="20%">请先选择管理文件归属.</td>
<td width="45%" >请先选择管理文件归属.</td>
<td width="35%">请先选择管理文件归属.</td
></tr>
<% End If %>


放在哪个位置啊。。我着加了判断也。。
pig510520 2009-12-21
  • 打赏
  • 举报
回复
if not rss.eof then
while not rss.eof
*
*
*
else
******
end if
h3214712 2009-12-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 gxq323 的回复:]
while not rss.eof
改成
while rss.recordcount>0
[/Quote]

一样的。。
没有效果 还是出错 --!

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧