在asp中通過getrows實(shí)現(xiàn)數(shù)據(jù)庫記錄分頁的一段代碼
更新時(shí)間:2006年11月17日 00:00:00 作者:
復(fù)制代碼 代碼如下:
<%@ Language = VBSCRIPT %>
<% Option Explicit %>
<%
rem 在asp中通過getrows實(shí)現(xiàn)數(shù)據(jù)庫記錄分頁的一段代碼
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
%>
<% Option Explicit %>
<%
rem 在asp中通過getrows實(shí)現(xiàn)數(shù)據(jù)庫記錄分頁的一段代碼
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
%>
相關(guān)文章
asp下用datediff實(shí)現(xiàn)計(jì)算兩個(gè)時(shí)間差的函數(shù)
asp下用datediff實(shí)現(xiàn)計(jì)算兩個(gè)時(shí)間差的函數(shù)...2007-11-11ASP讀取日期單日期自動(dòng)補(bǔ)零函數(shù)代碼
fillzero 函數(shù):月和日這兩個(gè)日期如果是單數(shù)的話前面補(bǔ)0。如2011年3月3日一般格式是2011-3-3通過函數(shù)轉(zhuǎn)化成2011-03-03這樣的格式。2011-01-01一個(gè)強(qiáng)健 實(shí)用的asp+ajax二級(jí)聯(lián)動(dòng)菜單(有演示和附源程序打包下載)
一個(gè)強(qiáng)健 實(shí)用的asp+ajax二級(jí)聯(lián)動(dòng)菜單(有演示和附源程序打包下載)...2007-07-07ASP上傳漏洞之利用CHR(0)繞過擴(kuò)展名檢測(cè)腳本
本文部分腳本具有攻擊性,僅供學(xué)習(xí)研究用,請(qǐng)用在合法合理范圍內(nèi),對(duì)造成的損失本人不承擔(dān)責(zé)任,本人也不提供黑客攻擊技術(shù)指導(dǎo)2012-01-01