帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > ASP编程
asp中通过getrows实现数据库记录分页的一段代码
作者:佚名 发布时间:2005-04-02 来源:不详
 

<%@ Language = VBSCRIPT %>
<% Option Explicit %>
<%
rem 在asp中通过getrows实现数据库记录分页的一段代码
Dim iStart, iOffset
iStart = Request("Start")
iOffset = Request("Offset")

if Not IsNumeric(iStart) or Len(iStart) = 0 then
iStart = 0
else
iStart = CInt(iStart)
end if

if Not IsNumeric(iOffset) or Len(iOffset) = 0 then
iOffset = 30
else
iOffset = Cint(iOffset)
end if

Response.Write "Viewing " & iOffset & " records starting at record " & iStart & "<BR>"

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
'objConn.Open "DSN=MP3"
dim connstr
dim db
db="csnjimageman.mdb"
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
objconn.Open connstr

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM imageinfo", objConn

Dim aResults
aResults = objRS.GetRows

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing


Dim iRows, iCols, iRowLoop, iColLoop, iStop
iRows = UBound(aResults, 2)
iCols = UBound(aResults, 1)

If iRows > (iOffset + iStart) Then
iStop = iOffset + iStart - 1
Else
iStop = iRows
End If

For iRowLoop = iStart to iStop
For iColLoop = 0 to iCols
Response.Write aResults(iColLoop, iRowLoop) & " "
Next
Response.Write "<BR>"
Next

Response.Write "<P>"
if iStart > 0 then
'Show Prev link
Response.Write "<A HREF=""GetRows.asp?Start=" & iStart-iOffset & _
"&Offset=" & iOffset & """>Previous " & iOffset & "</A>"
end if

if iStop < iRows then
'Show Next link
Response.Write " <A HREF=""GetRows.asp?Start=" & iStart+iOffset & _
"&Offset=" & iOffset & """>Next " & iOffset & "</A>"
end if
%>

 
  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·在你的ASP中使用类(class)  (2005-04-02)
 ·在ASP中使用简单Java类  (2005-04-02)
 ·在ASP中用集合成批操作数据库  (2005-04-02)
 ·ASP中使用组件搜索  (2005-04-02)
 ·ASP中五种连接数据库的方法  (2005-04-02)
 ·浅谈ASP中Web页面间的数据传递  (2005-04-02)
 ·在ASP中操作数据库的方法  (2005-04-02)
 ·ASP中几种分页显示的比较  (2005-04-02)
 ·ASP中健壮的页结构的异常处理  (2005-04-02)
 ·在ASP中使用脚本语言  (2005-04-02)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·在ASP中使用数据库
·使用ASP脚本技术
·通过启动脚本来感受ASP的力量
·学习使用ASP对象和组件
·解析asp的脚本语言
·初看ASP-针对初学者
·ASP开发10条经验总结
·ASP之对象总结
·ASP与数据库应用(给初学者)
·关于学习ASP和编程的28个观点
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统