Problemer med page count
Jeg bruker dette page count greiene:<%
intPage = Request(\"page\")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
search = Request.Form(\"search\")
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM News WHERE Title LIKE \'%\" & search & \"%\' OR News LIKE \'%\" & search & \"%\' ORDER BY Dated DESC\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"../admin/news.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 5
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
%>
<%
Response.Write \"<p><font face=\'verdana, arial, helvetica\' size=\'1\' color=\'#000000\'><b>Page \" & intPage & \" of \" & intPageCount & \"</b></font></p>\"
Do While Not rs.EOF And intRecCount > 0
Response.Write(\"<font face=\'verdana, arial, helvetica\' size=\'1\' color=\'#000000\'><b>\" & rs(\"Category\") & \":</b></font><br>\") & vbCrLf
Response.Write(\"<a href=\'http://www.ontheminute.com/news/\" & rs(\"Category\") & \"/news.asp?id=\" & rs(\"ID\") & \"\' class=menunews>\" & rs(\"Title\") & \"</a><br><font face=\'verdana, arial, helvetica\' size=\'1\' color=\'#000000\'>\") & vbCrLf
Response.Write(rs(\"Teaser\") & \"</font><br>\") & vbCrLf
Response.Write(\"<br><center><hr size=1 width=\'340\'></center>\") & vbCrLf
intRecCount = intRecCount - 1
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Response.Write \"<p><font face=\'verdana, arial, helvetica\' size=\'1\' color=\'#000000\'><b>Go to page:</b></font> \"
For intNum = 1 To intPageCount
Response.Write \"<a href=default.asp?page=\" & intNum & \" class=menunews><b>\" & intNum & \"</a> \"
Next
Response.Write \"<p>\"
If Clng(intPage) > 1 Then
Response.Write \"<center><a href=default.asp?page=\" & intPage - 1 & \" class=menunews><b><<</b></a>\"
Else
Response.Write \"<center><font face=\'verdana, arial, helvetica\' size=\'1\' color=\'#000000\'><b><<</b></font>\"
End If
Response.Write \" \"
If Clng(intPage) < Clng(intPageCount) Then
Response.Write \"<a href=default.asp?page=\" & intPage + 1 & \" class=menunews><b>>></b></a></center> \"
Else
Response.Write \"<font face=\'verdana, arial, helvetica\' size=\'1\' color=\'#000000\'><b>>></b></font></center>\"
End If
%>
---------------------
Prøv det på: http://www.ontheminute.com/news/archive/default.asp
Søk f.eks. på Copa America. da får du opp noen artikler. Men når du trykker på \"1\" page count griene.. kommer det andre artikler opp, ikke om de du søkte på...
Forstår dere ?
Hva må forrandres for at det skal virke bra ???