Må ikke blive skrevet hvis.........
Jeg har et \"paging af et recordset\" det virker fint men når der er 20 eller mindre nyheder så må den IKKE viseGå til side 1
Næste - Forige
den skal sjule det. Men når der er over 20 skal den vise det. Jeg SKAL have et færdigt resultat !
----------------------------------------------------
<table align=\"center\" bgcolor=\"#333333\" width=\"\"510\" cellspacing=\"1\" cellpadding=\"2\">
<tr>
<td bgcolor=\"111111\" width=\"510\"><center><strong>Nyheds Arkiv</strong></center></td>
</tr>
</table>
<br>
<%
\' Connection til database
Set Con = Server.CreateObject(\"ADODB.Connection\")
DBPath = \"DBQ=\" & server.mappath(\"database.mdb\")
Con.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; \" & DBPath
\' Her hiver vi indholdet af databasen ud, sorterer dem efter dato
Sql = \"SELECT * FROM nyheder ORDER BY dato DESC\"
Set rs = Con.Execute(Sql)
%>
<table align=\"center\" width=\"510\" cellspacing=\"0\" cellpadding=\"0\" class=\"ContentStyle\">
<tr>
<td width=\"510\" valign=\"top\">
<table width=\"510\" border=\"0\" bgcolor=\"#333333\" cellspacing=\"1\" cellpadding=\"2\" class=\"ContentStyle\">
<%
intPage = Request(\"page\")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM nyheder ORDER BY Id DESC\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 20
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
%>
<%
Do While Not rs.EOF And intRecCount > 0
%>
<tr>
<td bgcolor=\"#000000\" width=\"100%\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"ContentStyle\" width=\"100%\">
<tr><td><%= FormatDateTime(rs(\"dato\"),1)%> - <%= FormatDateTime(rs(\"dato\"),3)%></td><td align=\"right\"><a href=\"index.asp?mode=arkivvis&id=<%=rs(\"id\")%>\"><%=rs(\"title\")%></a></td></td></table></td>
</tr>
<%
intRecCount = intRecCount - 1
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
%>
</table>
<tr>
</tr>
</table>
<br>
<div align=\"center\">
<%
Response.Write \"Gå til side \"
For intNum = 1 To intPageCount
Response.Write \"<a href=index.asp?mode=arkiv&page=\" & intNum & \">\" & intNum & \"</a> \"
Next
For intNum = 1 To intPageCount
Next
Response.Write \"<p>\"
If Clng(intPage) > 1 Then
Response.Write \"[ <a href=index.asp?mode=arkiv&page=\" & intPage - 1 & \">Forige Side</a> ]\" %>
<% Else %>
[ <%Response.Write \"Forige Side\" %> ]
<% End If
Response.Write \" - \"
If Clng(intPage) < Clng(intPageCount) Then
Response.Write \"[ <a href=index.asp?mode=arkiv&page=\" & intPage + 1 & \">Næste Side</a> ]\" %>
<% Else %>
[ <%Response.Write \"Næste Side\" %> ]
<% End If %><br><br></div>