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

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

本文简介:选择自 applebbs 的 blog

end if
end if
set getrs=obj_rs
end property
'=================================================================
'getcurpagenum 属性
'返回当前页的记录集数目
'=================================================================
public property get getcurpagenum()
dim int_pagenum
int_pagenum = int_pagesize
if int_totalrecord= 0 then call getpage()
if int_curpage>int_totalpage then
int_curpage=int_totalpage
int_pagenum = int_totalrecord-(int_totalpage-1)*int_pagesize 
elseif int_curpage=int_totalpage then
int_pagenum = int_totalrecord-(int_totalpage-1)*int_pagesize 
end if
getcurpagenum = int_pagenum
end property
'================================================================
'getconn 得到数据库连接
'
'================================================================ 
public property let getconn(sconn)
set obj_conn=sconn
end property
'================================================================
'getsql 得到查询语句
'
'================================================================
public property let getsql(svalue)
str_sql=svalue
end property

'==================================================================
'class_initialize 类的初始化
'初始化当前页的值
'
'================================================================== 
private sub class_initialize
'========================
'设定一些参数的黙认值
'========================
int_pagesize=10 '设定分页的默认值为10
int_totalrecord= 0
'========================
'获取当前面的值
'========================
if request("page")="" then
int_curpage=1
elseif not(isnumeric(request("page"))) then
int_curpage=1
elseif cint(trim(request("page")))<1 then
int_curpage=1
else
int_curpage=cint(trim(request("page")))
end if
end sub
'====================================================================
'openrs 打开数据集
'有首页、前一页、下一页、末页、还有数字导航
'
'====================================================================
private sub openrs()
set obj_rs=server.createobject("adodb.recordset")
obj_rs.open str_sql,obj_conn,1,1
end sub
'====================================================================
'getpage 创建分页导航条
'有首页、前一页、下一页、末页、还有数字导航
'
'====================================================================
private sub getpage()
if typename(obj_rs)<>"object" then call openrs()
int_totalrecord=obj_rs.recordcount
if int_totalrecord<=0 then
str_errors=str_errors & "总记录数为零,请输入数据"
call showerror()
end if
if int_totalrecord mod pagesize =0 then
int_totalpage = int_totalrecord \ int_pagesize
else
int_totalpage = int_totalrecord \ int_pagesize+1

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

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

go top