|
 |
|
AFRICOM access 
|
|
|
|
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Set Cmd = Server.CreateObject("ADODB.Command")
'Set objRst = Server.CreateObject("ADODB.Recordset")
Cmd.CommandType = 1
Conn.Open "DSN=Africom;UID="
sqlstmt = "Select * From GuestBk order by date DESC"
'Cmd.CommandText = sqlstmt
'rs.Open Cmd.CommandText, Conn , adOpenstatic
DIM iPageSize 'Set number of records to display on each page of the RS
DIM iPageCount 'The number of records in the RS. We process this to calculate the PageNumber
DIM iPageCurrent 'The page number of the page we want to show
DIM iRecordsShown 'LOOP counter for displaying iPageSize number of Records. Acts as the ubiquitous i Loop Counter."
DIM noResultsFlag 'Flag to indicate that no records were found. Very important
DIM iDesiredPageCount 'Page count for printing page by page
DIM iCurrentPage, iPath 'Page count for printing page by page and the variable to get server variables
'Code for printing (funtion fro printing)
iPath = request.servervariables("url")
if iPath <> "" then
iPath = "ReportConfiguration.html?ReturnPath=" & iPath
else
iPath = "ReportConfiguration.html"
end if
Function OutputHeader
dim ibreaks, i, ibreaksTemp
ibreaks = 6
ibreaksTemp = ibreaks
iCurrentPage = cint(iCurrentPage + 1)
if iPagecount > 0 then
Response.Write " | "
if iCurrentPage = 2 then ibreaks = ibreaks - 2
for i = 0 to ibreaks
Response.Write " "
next
if iCurrentPage = 2 then ibreaks = ibreaksTemp
end if
iPagecount = 0
Response.Write "Page " & iCurrentPage
End Function
Function PageBreak()
dim iShortCount
PageBreak = False
if (cint(iDesiredPageCount) = cint(iPageCount)) then
PageBreak = True
end if
iShortCount = cint(iDesiredPageCount) - 2
if ((iShortCount) = cint(iPageCount) and (iCurrentPage = 1)) then
PageBreak = True
end if
end Function
'End of funtion for printing
iPageSize = 5
' Check to see if there is value in the NAV querystring. If there
' is, we know that the client is using the Next and/or Prev hyperlinks
' to navigate the recordset.
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
'Function calling for printing%>
<%
iPagecount = 0
iCurrentPage = 0
if Request("DesiredPageCount") <> "" then
iDesiredPageCount = Request("DesiredPageCount")
else
if Request.Cookies("LinesPerPage") <> "" then
iDesiredPageCount = Request.Cookies("LinesPerPage")
else
iDesiredPageCount = 5
end if
end if
'session("cisco")=Request.Form("Alavarion")
Set objRst = Server.CreateObject("ADODB.Recordset")
objRst.CursorLocation = 3
objRst.Open sqlstmt, Conn
tot= objRst.RecordCount
'Response.Write tot
set Session("RS") = objRst
session("GG") = Session("RS").RecordCount
if (Session("GG")) <=0 then
noResultsFlag = 1
end if
no_full = (Session("GG")) \ iPagesize
no_rem = (Session("GG")) Mod iPagesize
if no_rem > 0 then
no_full = no_full + 1
end if
iPageCount = no_full
if noResultsFlag = 1 then%>
There are no Records Currently in our Guest Book
Back
<%else
'
If iPageCurrent > iPageCount then iPageCurrent = iPageCount
If iPageCurrent < 1 then iPageCurrent = 1
'
objRst.AbsolutePosition = ((iPageCurrent - 1) * iPageSize) + 1
'%>
Guest Book
<%
number = Request.QueryString("num")
num = number
iRecordsShown = 0
Do while iRecordsShown < iPageSize And not objRst.EOF
num = num + 1
%>
<%If objRst("FirstName") = "" Then
Else%>
First Name |
<%=objRst("FirstName")%> |
<%End if
If objRst("Surname") = "" Then
Else%>
Surname |
<%=objRst("Surname")%> |
<%End if
If objRst("Gender") = "" Then
Else%>
Gender |
<%=objRst("Gender")%> |
<%End if
If objRst("Occupation") = "" Then
Else%>
Occupation |
<%=objRst("Occupation")%> |
<%End if
If objRst("Country") = "" Then
Else%>
Country |
<%=objRst("Country")%> |
<%End if
If objRst("Source") = "" Then
Else%>
How did you get to know about Africom? |
<%=objRst("Source")%> |
<%End if
If objRst("HomePage") = "" Then
Else%>
Home Page |
<%
home = objRst("HomePage")
if left(home,7) = "http://" then
Else
home = "http://" & objRst("HomePage")
End if
%>
<%=objRst("HomePage")%> |
<%End if
If objRst("Comments") = "" Then
Else%>
Comments |
<%=objRst("Comments")%> |
<%End if%>
|
<%
objRst.MoveNext
iRecordsShown = iRecordsShown + 1
Loop
%>
<%
' Iterate through the recordset until we reach the end of the page
' or the last record in the recordset.
'For intRecord = 1 to objRst.PageSize
' Response.Write " |
| " & objRst("Description") & " |
"
' objRst.MoveNext
' If objRst.EOF Then Exit for
'Next
%>
<%
' Check to see if the current page is greater than the first page
' in the recordset. If it is, then add a "Previous" link.
If iPageCurrent <> 1 Then%>
<%Response.Write " "%>
<< Prev |
<%End IF%>
<%
' Check to see if the current page is less than the last page
' in the recordset. If it is, then add a "Next" link.
If iPageCurrent < iPageCount Then%>
<%Response.Write " "%>
Next >>
<%End If%>
<%End If%>
|
|