第一次搞asp,帮一个MM做的。大家看看什么错误

kid83 2005-07-19 02:01:27
错误类型:
ADODB.Field (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/listAll.asp, 第 17 行


<!-- #include file="connection.asp" -->
<%
dim cate
dim categoryName
dim rst
dim strSQL
dim page
dim maxPageCount

set rst=Server.CreateObject("ADODB.Recordset")

strSQL="update click set click=click+1 where page='商务会讯'"
cnn.execute(strSQL)

strSQL="select click from click where page='商务会讯'"
rst.open strSQL,cnn,3,1
iClick=rst(0)
rst.close

cate=Request.QueryString("category")

strArticleCategory = Request.QueryString("articleCategory") & ""
strArticleCategory = trim(strArticleCategory)

if cate="article" and strArticleCategory="" then response.redirect "listArticle.asp"

if 11=0 then '--- 暂时不要登陆了

if cate="article" then
if session("china_qg_user")="" then
%>
<%
end if
end if

end if

strType=request("type") & ""
strArea=request("area") & ""

iSelf = Request("iSelf") & ""
if iSelf="T" then
iSelf=1
else
iSelf=2
end if

strType=trim(strType)
strArea=trim(strArea)



page=Request.QueryString("page")
if page="" or (not isnumeric(page)) then page=1
page=cint(page)

if cate<>"" then
strSQL="select * from infoCategory where categoryID='" & cate & "'"
'response.write strsql

rst.open strSQL,cnn,3,1
categoryName=rst("categoryName")
rst.close

%>
<HTML>
<HEAD>
<TITLE>中国企管网 --- <% Response.write(Request.QueryString("type")) %><% Response.write(Request.QueryString("area")) %></TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<link rel="stylesheet" type="text/css" href="CssAndJs/Main.css">
<style>
body,td{
font-size:12px;
line-height:180%;
}
</style>
</HEAD>

<BODY topmargin=0 leftmargin=1>
<center>
<script language="JavaScript" src="cssandjs/top.js"></script>
<table width=776 border=0 border=0 cellspacing=0 cellpadding=0>
<tr height="400">

<td width="10"> </td>
<td width="560" valign="top"><BR>
<%
if categoryName<>"商务会议" then
%>
当前位置:<a href="/" style="text-decoration:underline">首  页</a> >> <%=categoryName%><BR><BR><% end if%>
<%
if categoryName="商务会议" then
%>
<B>课程类型导航:</B>
<a href="listAll.asp?category=meeting&type=战略管理" style="text-decoration:underline">战略管理</a>  
<a href="listAll.asp?category=meeting&type=市场营销" style="text-decoration:underline">市场营销</a>  
<a href="listAll.asp?category=meeting&type=人力资源" style="text-decoration:underline">人力资源</a>  
<a href="listAll.asp?category=meeting&type=专业认证" style="text-decoration:underline">专业认证</a>  
<a href="listAll.asp?category=meeting&type=财务管理" style="text-decoration:underline">财务管理</a>  
<a href="listAll.asp?category=meeting&type=综合管理" style="text-decoration:underline">综合管理</a>  
<a href="listAll.asp?category=meeting&type=供应链体系" style="text-decoration:underline">生产管理</a><BR>
<B>区域课程导航:</B>
<a href="listAll.asp?category=meeting&area=北京" style="text-decoration:underline">北京</a>  
<a href="listAll.asp?category=meeting&area=上海" style="text-decoration:underline">上海</a>  
<!--<a href="listAll.asp?category=meeting&area=南京" style="text-decoration:underline">南京</a>  -->
<a href="listAll.asp?category=meeting&area=广州" style="text-decoration:underline">广州</a>  
<a href="listAll.asp?category=meeting&area=深圳" style="text-decoration:underline">深圳</a>  
<BR><BR>
<%
end if
%>

<%
strSQL="select * from information where category='" & cate & "' order by publishTime desc"
strSQL="select ID,category,title,content,publishTime from information where 1=1"

if cate<>"" then strSQL=strSQL & " and category='" & cate & "'"
if strType<>"" then strSQL=strSQL & " and charIndex('" & strType & "',type)>0"
if strArea<>"" then strSQL=strSQL & " and area='" & strArea & "'"

if iSelf=1 then strSQL=strSQL & " and ifSelf=1"
if strArticleCategory<>"" then strSQL=strSQL & " and charIndex('" & strArticleCategory & "',articleCategory)>0"

strSQL=strSQL & " order by beginTime desc,publishTime desc"
'response.write strsql

rst.open strSQL,cnn,3,1
if not (rst.bof and rst.eof) then

'-----------------------------------------
rst.pagesize=33
maxPageCount=rst.pageCount
rst.AbsolutePage=page
if page>maxPageCount then page=maxPageCount

i=0
'-----------------------------------------

response.write "<table width='100%' border=0 cellpadding='0' cellspacing='0'>"
do while not rst.eof and i<rst.PageSize
response.write "<tr height='22'>"

response.write "</td>"
response.write "<td width='10'> </td>"
response.write "<td align=left width='550'> · "

if cate="article" then
response.write "<a href=viewArticle.asp?ID=" & rst("ID") & "&category="
else
response.write "<a href=detail.asp?ID=" & rst("ID") & "&category="
end if
response.write cate & " target=_blank>"
title=rst("title")
if rst("content")="" then title=title & "[无内容]"
response.write "<font style='font-size:14px'>" & title & "</font></a>"
if cate="article" or cate="news" then
response.write " <font color='#808080' style='font-size:12px'>("
response.write formatdatetime(rst("publishTime"),vbshortdate)
response.write ")</font>"
end if

response.write "</td>"
response.write "</tr>"

if (((i+1) mod 5)=0 and i>0) then
response.write "<tr height='16'><td colspan='2'></td></tr>"
'response.write i
end if
rst.movenext
i=i+1
loop
response.write "<tr>"
response.write "<td colspan='4' align='right' height='36'>"


if maxPageCount>1 then
%>

<BR>
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#EEEEEF" height="26" >
<tr>
<td height="1" bgcolor="#D30000" colspan="2"></td>
</tr>
<tr>
<td align="left" height="22">  

<%
strHref="<a href=listAll.asp?category=" & cate & "&page="


if page=1 then response.write "<B>首  页</B> | "
if page>1 then
response.write strHref & "1><B>首  页</B></a> | "
response.write strHref & page-1 & "><B>前一页</B></a> | "
else
response.write "<B>前一页</B> | "
end if

if page<maxPageCount then
response.write strHref & page+1 & "><B>下一页</B></a> | "
else
response.write "<B>下一页</B> | "
end if

if page=maxPageCount then
response.write "<B>末  页</B>"
else
response.write strHref & maxPageCount & "><B>末  页</B></a>"
end if

response.write "        "
response.write "当前:" & Page & " / " & maxPageCount & " 页"
'response.write "        "
response.write "</td>"
response.write "</tr>"
response.write "</table>"

end if


response.write "</td>"
response.write "</tr>"
response.write "</table>"
else
response.write "还没有相关的内容!"
end if
rst.close
%>

<%
if strType<>"" then
rst.open "select click from click where page='" & strType & "'",cnn,3,1
if not (rst.bof and rst.eof) then iClicks=rst(0)
end if
if strArea<>"" then
rst.open "select click from click where page='" & strArea & "'",cnn,3,1
if not (rst.bof and rst.eof) then iClicks=rst(0)
end if

'response.write "select click from click where page='" & strArea & "'"

response.write "<font color='#FFFFFF'>" & iClicks & "</font>"
%>
</BODY>
</HTML>

<%
end if

cnn.close
set rst=nothing
set cnn=nothing
%>
...全文
132 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lsgis2001 2005-07-19
  • 打赏
  • 举报
回复
就是说你的记录集里面没有值。
可能是没有合你的条件的记录,也可能是你在循环时记录集的下标越界了。
谢紫枫 2005-07-19
  • 打赏
  • 举报
回复

问一句 net里面的记录集不是这样判断是否为空的吗?
基本没用过net但是记得好像也可以用ADODB连接的不是吗?
jack813 2005-07-19
  • 打赏
  • 举报
回复
记录集越界?
chinawn 2005-07-19
  • 打赏
  • 举报
回复
太长了,头晕了
king2410 2005-07-19
  • 打赏
  • 举报
回复
意思是记录内容不为空是才给变量赋值


不错,为了搞MM,搞NET的也回头来搞ASP了
kid83 2005-07-19
  • 打赏
  • 举报
回复
数据库的值多着捏。
If rst.EOF = false Then iClick=rst(0)
什么意思啊?抱歉一直做net,没摸过asp
ice241018 2005-07-19
  • 打赏
  • 举报
回复
你的数据库为空。
或者是你的数据库记录不完整。
将该记录值删除,即可
孟子E章 2005-07-19
  • 打赏
  • 举报
回复
使用之前要先判断

If rst.EOF = false Then iClick=rst(0)
孟子E章 2005-07-19
  • 打赏
  • 举报
回复
使用之前要先判断

If rst.EOF = false Then iClick=rst(0)

28,404

社区成员

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

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