%@language=vbscript%>
<%
'Create the MyConnection Object and Open the connection to the database using your DSN
Set MyConnection = Server.CreateObject("Adodb.Connection")
MyConnection.open "DSN=DSNtest;Username=admin;Password=password;"
'Write your Query
MyQuery = "Select FieldName from TableName"
perpage = 10
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
Set myrs = Server.CreateObject("adodb.recordset")
myrs.open myquery, MyConnection, adopenkeyset, adlockoptimistic
If myrs.eof Then
Response.Write "
Sorry, no records were found. |
|
"
ElseIf request("start") = "" Then
start = 1
Else
start = CInt(request("start"))
End If
torecs = ((start+perpage)-1)
If torecs > myrs.recordcount Then
torecs = myrs.recordcount
End If
i = 1
mypagenavigationbar = ""
For n = 1 To myrs.recordcount step perpage
If n <> 1 Then mypagenavigationbar = mypagenavigationbar & " | "
If n = CInt(start) Then
mypagenavigationbar = mypagenavigationbar & ""&i&""
Else
mypagenavigationbar = mypagenavigationbar & ""
mypagenavigationbar = mypagenavigationbar & i & ""
End If
i = i + 1
Next
i = 1
myrs.move start - 1
Response.Write ""
Response.Write "Records ("&start& "-" & torecs & " of " & myrs.recordcount&") Page(s) : "&mypagenavigationbar&" | "
Response.Write " |
"
Response.Write "FieldNameHeading | "
Response.Write " "
iscolor = True
For row = start To start + (perpage - 1)
If myrs.eof Then Exit For
If iscolor Then
Response.Write ""
iscolor=False
Else
Response.Write " "
iscolor=True
End If
Response.Write ""& Myrs("FieldName")& " | "
Response.Write " "
i = i + 1
myrs.movenext
Next
Response.Write "
|
"
'Close the Recordset
myrs.close
Set myrs = Nothing
'Close the Connection
MyConnection.close
Set MyConnection = Nothing
%>