[求助]ASP自动分页问题,
[求助]没有为命令对象设置命令????敬请各位帮帮忙!!!谢谢 没有为命令对象设置命令????敬请各位帮帮忙!!!谢谢
错误类型:
Microsoft JET Database Engine (0x80040E0C)
没有为命令对象设置命令。
/jony/conn.asp, 第 40 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
代码如下:
<%
dim conn
dim connstr
dim db
'更改数据库名字
db="conn.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
'如果你的服务器采用较老版本Access驱动,请用下面连接方法
'connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db.mdb")
conn.Open connstr
Function CloseDB
conn.close
set conn=nothing
End Function
' if classid="" then
' classid=0
' response.Write"非法操作!没有传递参数!"
' else
dim n,totalrec,currentpage,rowcount,msg_per_page,i
msg_per_page = 12
set rs=server.createobject("adodb.recordset")
'sql=""&sql0&""
rs.cursorlocation = 3 '客户端游标
rs.pagesize = msg_per_page
rs.open,conn,1,3
if rs.eof or rs.bof then
response.Write("<tr><td align='center' colspan='3' height='50'>此系列暂无产品!</td></tr>")
else
if err.number<>0 then
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
totalrec = RS.RecordCount 'totalrec:总记录条数
if rs.recordcount mod msg_per_page = 0 then '计算总页数,recordcount:数据的总记录数
n = rs.recordcount\msg_per_page 'n:总页数
else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page") 'currentpage:当前页
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage 'absolutepage:设置指针指向某页开头
rowcount = rs.pagesize 'pagesize:设置每一页的数据记录数
do while not rs.eof and rowcount > 0
response.Write("<tr><td align='center' width='33%' valign='bottom'><a href=view.asp?id="&rs("id")&"><img src='"&rs("smallimg")&"' border='0'></a><br>"&rs("model")&"</td>")
rowcount=rowcount-1
rs.movenext
if not rs.eof then
response.Write("<td align='center' width='33%' valign='bottom'><a href=view.asp?id="&rs("id")&"><img src='"&rs("smallimg")&"' border='0'></a><br>"&rs("model")&"</td>")
rowcount=rowcount-1
rs.movenext
end if
if not rs.eof then
response.Write("<td align='center' width='34%' valign='bottom'><a href=view.asp?id="&rs("id")&"><img src='"&rs("smallimg")&"' border='0'></a><br>"&rs("model")&"</td>")
rowcount=rowcount-1
rs.movenext
end if
response.Write("</tr>")
response.Write("<tr><td height='20' colspan='3'><hr size='1' color='#EEEEEE' noshade></td></tr>")
loop
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
---------------
敬请各位帮帮忙!!!谢谢