超级ASP大分页_我的类容我做主[4]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 applebbs 的 blog

'====================================================================
'showpageinfo 分页信息
'更据要求自行修改
'
'====================================================================
private function showpageinfo()
dim str_tmp
str_tmp="页次:"&int_curpage&"/"&int_totalpage&"页 共"&int_totalrecord&"条记录 "&int_pagesize&"条/每页"
showpageinfo=str_tmp
end function
'==================================================================
'geturl 得到当前的url
'更据url参数不同,获取不同的结果
'
'==================================================================
private function geturl()
dim strurl,tmp_url,i,j,search_str,result_url
search_str="page="
strurl=request.servervariables("url")
strurl=split(strurl,"/")
i=ubound(strurl,1)
tmp_url=strurl(i)'得到当前页文件名
str_params=trim(request.servervariables("query_string"))
if str_params="" then
result_url=tmp_url & "?page="
else
if instrrev(str_params,search_str)=0 then
result_url=tmp_url & "?" & str_params &"&page="
else
j=instrrev(str_params,search_str)-2
if j=-1 then
result_url=tmp_url & "?page="
else
str_lparams=left(str_params,j)
str_rparams=right(str_params,len(str_params)-j-1)
if instr(str_rparams,"&")<>0 then
str_rparams=right(str_rparams,len(str_rparams)-instr(str_rparams,"&")+1)
else
str_rparams = ""
end if
result_url=tmp_url & "?" & str_lparams&str_rparams&"&page="
end if
end if
end if
geturl=result_url
end function
'====================================================================
' 设置 terminate 事件。
'
'====================================================================
private sub class_terminate 
obj_rs.close
set obj_rs=nothing
obj_conn.close
set obj_conn = nothing
end sub
'====================================================================
'showerror 错误提示
'
'
'====================================================================
private sub showerror()
if str_errors <> "" then
response.write("" & str_errors & "")
response.end
end if
end sub
end class 
%>

<!--#include file="include/function.asp"-->
<%
dim conn
call dbconnect()
'#############类调用样例#################
'创建对象
set hjmpage=new showmorepage
'得到数据库连接
hjmpage.getconn=conn
'sql语句
hjmpage.getsql="select top 6 * from shop_books where newsbook=1 order by bookid desc"
'设置每一页的记录条数据为5条
hjmpage.pagesize=2
set rs=hjmpage.getrs() '返回recordset
'显示分页信息,这个方法可以,在set rs=hjmpage.getrs()以后,可在任意位置调用,可以调用多次
hjmpage.showpage()
'显示数据
response.write("<br/>")

本文关键:超级ASP大分页_我的类容我做主
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top