Tags:
programmering
Hej
Er der nogen der kan hjælpe mig med at ændre denne kode, så den skifter side for hvert 15. post? Den siger, at der er en fejl ved " rs.AbsolutePage = nPage" og noget med at recordsettet ikke tillader Bookmarks...
________________________________________________
<font size="1" face="Verdana">
<%
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("db/database.mdb")
strSQL = "SELECT * FROM [elements] ORDER BY [dato]"
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
nPage = Request("page")
If isNumeric(nPage) = False Or nPage < 1 Then
nPage = 1
End If
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 10
rs.AbsolutePage = nPage
nRecCount = rs.PageSize
nPageCount = rs.PageCount
Response.Write "Side " & nPage & " af " & nPageCount & "<br>"
If NOT nPageCount = 0 Then
Response.Write "Gå til side "
For nNum = 1 To nPageCount
Response.Write "<a href='vis_alle.asp?page=" & nNum & "&sort=" & request.querystring("sort") &"'>" & nNum & "</a>"
Next
Response.Write ""
If Clng(nPage) > 1 Then
Response.Write "<a href='vis_alle.asp?page=" & nPage - 1 & "&sort=" & request.querystring("sort") &"'><<</a>"
Else
Response.Write "<<"
End If
Response.Write " "
If Clng(nPage) < Clng(nPageCount) Then
Response.Write "<a href='vis_alle.asp?page=" & nPage + 1 & "&sort=" & request.querystring("sort") &"'>>></a>"
Else
Response.Write ">>"
End If
End If
noCols=0
maxAntalCols=3
response.write "<table align='left' width='100%'>"
Do While Not RS.EOF And nRecCount > 0
if noCols=0 then Response.Write "<tr>"
response.write "<td valign='top'>" %>
<table align="left" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td align="center" valign="top">
<font face="Verdana" size="2">Besøg: <%=rs("antal")%><br>Type: <%=rs("type")%><br><b><%=rs("navn")%></b>, <%=rs("kategori")%><br>
<a href="spilprofil.asp?id=<%=rs("id")%>"><img width="100px" height="100" src="<%=rs("picture")%>"></a><br><br></font>
</td></tr>
</table>
<%
noCols=noCols+1
nRecCount = nRecCount - 1
response.write "</td>"
if noCols=maxAntalCols then
response.write "</tr>"
noCols=0
End If
rs.MoveNext
Loop
if noCols>0 then Response.write "</tr>"
response.write "</table>"
Else
' Hvis der ikke er skrevet noget
Response.Write "Der er endnu ingen spil/film!"
End If
End If
myConn.Close
Set Conn = Nothing
%>
</font>
Jeg håber virkelig, I kan hjælpe mig, for jeg er meget lost!
W13