欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp伪继承初探_实例代码

程序员文章站 2022-07-01 23:39:00
其中使用到一个分页类cpaging 复制代码 代码如下:class cpaging public rs ' recordset对象 public mark ' 指针标签 p...
其中使用到一个分页类cpaging
复制代码 代码如下:

class cpaging
public rs ' recordset对象
public mark ' 指针标签
private ssize ' 每页显示数
private stotal ' 总记录数
private spage ' 当前页码
private scount ' 总页码
private sub class_initialize
ssize = 20
spage = 1
scount = 1
end sub
private sub class_terminate
closeobj rs
end sub
'每页显示数
property let size(value)
ssize = value
end property
property get size
size = ssize
end property
'当前页码
property let page(value)
if not isnumeric(value) then
spage = 1
else
spage = value
end if
end property
property get page
if (spage - 1) * ssize > stotal then
if stotal mod ssize = 0 then
page = total \ ssize
else
page = total \ ssize +1
end if
elseif spage < 1 then
page = 1
else
page = spage
end if
end property
'总页码
property get count
if stotal mod ssize = 0 then
count = stotal \ ssize
else
count = stotal \ ssize + 1
end if
end property
'总记录数
property get total()
total = stotal
end property
public function open(byval sqlstring)
try db.openquery(rs,sqlstring)
stotal = rs.recordcount
end function
end class

以下是调用页 
复制代码 代码如下:

dim products
set products = new cpaging
with products
.size = 15 '每页显示数
.page = pagenum '当前页
end with
try products.open(listsql)
if products.rs.bof and products.rs.eof then
response.write("<tr><td colspan=8>查找无记录</td></tr>")
else
dim i
i = 0
products.rs.move (products.page - 1) * products.size
do while not products.rs.eof
response.write("<tr onmouseup=mouseup(this); onmousedown=mousedown(this); onmouseover=mouseover(this); onclick=click(this); onmouseout=mouseout(this);>"&vbcrlf)
response.write("<td align=middle nowrap>" & products.rs("productsclassname") & "</td>"&vbcrlf)
response.write("<td align=left nowrap>" & products.rs("productsname") & " </td>"&vbcrlf)
response.write("</tr>"&vbcrlf)
i=i+1
if i >= products.size then exit do
products.rs.movenext
loop
end if

当看到第8行的时候,似乎窥到了.net的影子--命名空间?