%
dim con
dim recset
dim sstr
dim varPageSize
'--------Paging--------
Dim Page
Dim RowCount
Dim PageCounter
Dim Currpage, pageLen, lastNumber, PageRem, PageTen
Dim next10, prev10, P
Dim RSPrevPage, RSNextPage, start
If IsEmpty(Request.Querystring("PageNo")) then
CurrPage = 1
Else
CurrPage = Cint(Request.Querystring("PageNo"))
End If
'the two functions below return the next 10 and prev 10 page number
Function getNext10(num)
pageLen = len(num)
If pageLen = 1 Then
next10 = 10
Else If pageLen>1 Then
pageRem = 10
pageTen = right(num, 1)
next10 = num + pageRem - pageTen
End If
End If
getNext10 = next10
End Function
Function getPrev10(num)
pageLen = len(num)
If pageLen = 1 then
prev10 = 1
Else If pageLen>1 then
lastNumber = right(num, 1)
prev10 = num - lastNumber - 10
End If
End If
If prev10 = 0 then
prev10 = 1
End If
getPrev10 = prev10
End Function
'----------------------
set con=Server.CreateObject("ADODB.Connection")
con.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("MyDatabase.mdb")
con.open
set recset=Server.CreateObject("ADODB.Recordset")
recset.CursorLocation = 3
if request.querystring("txtfrm")="yes" then
sstr="SELECT * FROM TabInstituteMast where SrNo is not null and Varified='yes'"
if request.querystring("txtInstituteName")<>"" then
sstr=sstr & " and InstName like '%" & trim(request.querystring("txtInstituteName")) & "%'"
end if
if request.querystring("cboCity")<>"AllCities" then
sstr=sstr & " and City like '%" & trim(request.querystring("cboCity")) & "%'"
end if
session("PageSize")=cINT(request.querystring("RecPerPage"))
varPageSize=session("PageSize")
end if
if request.querystring("sc")<>"" then
sstr="SELECT * FROM TabInstituteMast where SrNo is not null and Varified='yes'"
sstr= sstr & " and InstName like '" & request.querystring("sc") & "%'"
varPageSize=5
end if
'------if page is submited by paging hyperlink
if request.querystring("PageNo")<>"" then
'sstr="SELECT * FROM TabInstituteMast where SrNo is not null"
sstr=session("MySearchQuery")
sstr=sstr & ""
varPageSize=session("PageSize")
end if
session("MySearchQuery")=sstr
recset.open sstr,con,0,1
if recset.eof=false then
recset.PageSize=varPageSize
recset.AbsolutePage = CurrPage
end if
%>
Food, Cooking and Recipes, Hotels, Hotel Management Institutes, Cooking
Ware Suppliers & Manufactures, Indian Cuisine, Photo Gallery,Hospitality Books,
Cooking Basics, Dictionaries & Glossaries, Wine & Drinks, Restaurants, Indian
Hotels, HM Institutes, Manufactures & Suppliers, Study Material, Alumni
|
|
 |
|
|
|
|
|
Institutes |
<%
if recset.eof=false then
next10 = getNext10(CurrPage)
prev10 = getPrev10(CurrPage)
%>
<%
Do Until recset.AbsolutePage <> CurrPage OR recset.Eof
%>
|
|
<%
response.flush
recset.MoveNext
Loop
%>
|
|
|
Page
<%
'the next 2 lines setup the page number for the "previous" and "next" links
RSPrevPage = CurrPage -1
RSNextPage = CurrPage + 1
'find out the number of pages returned in the recordset
'if the Next10 page number is greater than the recordset page count
'then set Next10 to the recordset pagecount
If Next10 > recset.PageCount Then
Next10 = recset.PageCount
End If
'the variable start determines where to start the page number navigation
' i.e. 1, 10, 20, 30 and so on.
If prev10 = 1 AND next10 - 1 < 10 Then
start = 1
Else
start = Next10 - 10
If right(start, 1) > 0 Then
start = replace(start, right(start, 1), "0")
start = start + 10
End If
End If
'This checks to make sure that there is more than one page of results
If recset.PageCount > 1 Then
'Work out whether to show the Previous 10 '<<'
If next10 > 10 Then
response.write("<< ")
End If
'Work out whether to show the Previous link '<'
If NOT RSPrevPage = 0 then
response.write("Prev ")
End If
'Loop through the page number navigation using P as our loopcounter variable
For P = start to Next10
If NOT P = CurrPage then
response.write("" & P & " ")
Else
'Don't hyperlink the current page number
response.write(" " & P & " ")
End If
Next
'this does the same as the "previous" link, but for the "next" link
If NOT RSNextPage > recset.PageCount Then
response.write("Next ")
End If
'Work out whether to show the Next 10 '>>'
If NOT Next10 = recset.PageCount Then
response.write(" >>")
End If
End If
' Close the recordset and connection object
recset.Close
Set recset= Nothing
con.Close
Set con=Nothing
%>
|
<%else%>
|
Record Not Found!
Search Again
|
<%end if%>
|
|
|
|
 |
|
|
|