不好意思,又麻烦大家,我实在没有办法~!我调了半天,老是出错~帮忙看一下这段代码~!

zhyoli 2002-06-13 08:46:42
这是代码
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<!--#include file="path.asp"-->
<%dim zj,zz1
zfl_idd=request("dl_id")
zfl_id=trim(request("dl_id"))
%>
<%set rs=server.createobject("ADODB.recordset")
rs.open "Select count(*) as total from new where zfl_id='"& zfl_id &"'",con,1,1
set rs1=server.createobject("ADODB.recordset")
rs1.open "Select *from new where zfl_id='"&zfl_id&"' order by new_id desc",con,1,1
set rs3=server.createobject("ADODB.recordset")
rs3.open "select * from zfl where zfl_id="&zfl_id,con,1,1
%>
<HTML><HEAD><TITLE>新高新网络文学<%=rs3("zfl_name")%></TITLE>
<link rel="stylesheet" href="css2.css" type="text/css">
</head>

<BODY text=#000000 bgColor=#ffffff topMargin=0 leftmargin="5">
<table width="713" border="0" cellspacing="1" cellpadding="0" align="center" height="183">
<tr>
<td bgcolor="#FFFFFF" valign="top" height="275">
<table width="750" border="0" cellpadding="0" cellspacing="0" height="198">
<tr>
<td bgcolor="#FFFFFF" height="235" valign="top" width="318">  </td>
<td bgcolor="#FFFFFF" height="294" valign="top" width="300">
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="42" align="center">
<tr bgcolor="#FFFFFF">
<td width="42%" height="21">
<div align="left"><img src="imagewx/line4.jpg" width="183" height="18"></div>
</td>
</tr>
<%if rs1.eof and rs1.bof then
response.write"<td colspan='3' bgcolor='#f3f3f3'> "&rs3("zfl_name")&"下还没有文章呢,等你来投稿呢!^_^</td>"
response.end
else
recordtotal=rs("total")
pagecount=10
pagenum=int(recordtotal/pagecount+0.5)
page=request("page")
k=0
rs1.move pagecount*page
do while not rs1.eof
k=k+1
if k>10 then exit do
%>
<tr bgcolor="#FFFFFF">
<td width="42%" height="18" >
<% if len(trim(rs1("biaoti")))>30 then%>
<img src="imagewx/di.gif" width="12" height="11"><a href="news.asp?new_id=<%=cstr(rs1("new_id"))%>" target="_blank"><%=mid((trim(rs1("biaoti"))),1,30)%></a><a href="news.asp?new_id=<%=cstr(rs1("new_id"))%>" target="_blank">...</a>
<%else%>
<a href="news.asp?new_id=<%=cstr(rs1("new_id"))%>" target="_blank"><img src="imagewx/di.gif" width="12" height="11" border="0"></a>
<a href="news.asp?new_id=<%=cstr(rs1("new_id"))%>" target="_blank"><%=left(trim(rs1("biaoti")),15)%></a>
<% end if
if rs1("img")=1 then
response.write "<img src='images/img.gif' border=0 width=16 height=16 align=middle>"
end if
%>
<%dim two_d
two_d=DateDiff( "d", CDate(rs1("time")), Now)
if two_d<=3 then
%>
<img src="IMAGES/newdd.gif" width="28" height="11">
<%
end if
%>
<a href="aa.htm"> </a></td>
</tr>
<% rs1.movenext
num=num+1
loop
rs1.close
set rs1=nothing
end if%>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="23">
<tr>
<td>
<%if pagenum>10 then pagenum=10%>
总页数:
<%for i=0 to pagenum%>
<a href="zfl.asp?page=<%=i%>&zz=<%=zfl_idd%>"><%=i+1%></a>|
<%next%>
</td>
</tr>
</table>
</td>
<td bgcolor="#FFFFFF" height="249" valign="top" width="154">
<table width="99%" border="0" cellspacing="0" cellpadding="0" height="82" align="center">
<tr>
<td valign="top" height="112" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="26">
<tr>
<td bgcolor="#FFFFFF" height="15">
<div align="center"><font color=#ffffff><img src="imagewx/link1.jpg" width="136" height="20"></font></div>
</td>
</tr>
</table>
<%set rs10=server.createobject("ADODB.recordset")
rs10.open"select new_id from new where zfl_id='"&request("zfl_id")&"'",con,1,1
function todays()
dim tmprs
tmprs=cn.execute("Select count(new_id) from new Where zfl_id=zfl_id and year(time)=year(date()) and month(time)=month(date()) and day(time)=day(date())")
todays=tmprs(0)
set tmprs=nothing
if isnull(todays) then todays=0
end function

function toweeks()
dim tmprs
tmprs=cn.execute("Select count(new_id) from new Where zfl_id=zfl_id and year(time)=year(date()) and month(time)=month(date())and day(date())-day(time)<=7")
toweeks=tmprs(0)
set tmprs=nothing
if isnull(toweeks) then toweeks=0
end function
%>
<div align="center"><%=rs3("zfl_name")%>文章总数:<font color="#ff0000"><%=rs10.recordcount%></font><br>
<%=rs3("zfl_name")%>今日文章:<font color="#ff0000"><%=todays()%></font><br>
<%=rs3("zfl_name")%>本周文章:<font color="#ff0000"><%=toweeks()%></font></div>
</td>
</tr>
<%rs3.close
set rs3=nothing%>
</table>
</td>
</tr>
</table>
<div align="left"></div>
</td>
</tr>
</table>
<p align="center"><b><font size="2"> </font></b></p>
</BODY></HTML>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
这是错误提示~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
在点击分页时出现以下问题~
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
/hotweb1/zfl.asp, 第 11 行
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
主要是分页的问题`!~我也不想把这么长的代码贴出来~!`可就我一个人~!没有办法`!
只有请教各位大哥了~!如果为难~!`请大家指出来`!~
谢谢~
...全文
25 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
nice90 2002-06-13
  • 打赏
  • 举报
回复
你上面的这段代码出错应该是连接数据库出错了的。但是我一时看不出个大概。给你一段分页的代码看看别人怎么写的,可能对你有帮助。
<%@ language=VBScript%>
<%
dim Conn,Rs,strSQL
dim page
set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open"filedsn=db1.dsn"
strSQL="SELECT * FROM 表1 order by BookName"
set Rs=Server.CreateObject("ADODB.Recordset")
Rs.Source=strSQL
Rs.ActiveConnection=Conn
Rs.CursorType=3
RS.Open
Rs.PageSize=4
if Request("page")="" then
page=1
else
page=CInt(Request("page"))
end if
Rs.AbsolutePage=page
%>
<html>
<head>
<body>
<p>
<table border="0" width="50%">
<tr>
<td width="20%">转到:</td>
<%for i=1 to Rs.PageCount%>
<td width="20%">
<a href="pageshow.asp?page=<%=i%>">第<%=i%>页</a>
</td>
<%Next%>
</tr>
</table>
<hr>
<table width="100%" border="1">
<%
'第一行表示的是字段
%>
<tr>
<%for i=0 to Rs.Fields.Count-1%>
<td align="center">
<b>
<%=Rs(i).Name%>
</b>
</td>
<%Next%>
</tr>
<%
'第二行起表示的是书库中的内容
%>
<%For j=1 to RS.pageSize%>
<tr>
<%for i=0 to Rs.Fields.Count-1%>
<td align="center">
<%if isnull(Rs(i)) then%>
 
<%else%>
<%=RS(i)%>
<%end if%>
</td>
<%Next%>
</tr>
<%
Rs.MoveNext
If Rs.EOF then
Exit For
End If
Next
%>
</table>
<hr>
<table border="0" width="50%">
<tr>
<td width="50%">
<%if Page>1 then%>
<a href="pageshow.asp?page=<%=(page-1)%>"><<<上一页</a>
<%End if%>
</td>
<td width="50%">
<%if page<Rs.pageCount Then%>
<a href="pageshow.asp?page=<%=(page+1)%>">下一页>>></a>
<%End if%>
</td>
</tr>
</table>
<%
Rs.Close
Conn.Close
%>
</body>
</html>
pageshow.asp循环的调用就可以了.
possible_Y 2002-06-13
  • 打赏
  • 举报
回复
记录集的锁定方式不对,打开记录集是应该为:
set rs=server.createobject("ADODB.recordset")
rs.open "Select count(*) as total from new where zfl_id='"& zfl_id &"'",con,3,3
set rs1=server.createobject("ADODB.recordset")
rs1.open "Select *from new where zfl_id='"&zfl_id&"' order by new_id desc",con,3,3
set rs3=server.createobject("ADODB.recordset")
rs3.open "select * from zfl where zfl_id="&zfl_id,con,3,3

28,408

社区成员

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

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