Hej VtmServer
Her har du et stykke kode som skulle hjælpe dig..
Jeg har omskrevet din kode så den er i SUB og FUNCTION
Den skulle gøre det samme som din, men virke:
Mvh
Mr.Spock 8)
------------
<%
Const MAX_LINES_PER_PAGE = 10
VisListe
sub VisListe
Dim Page, ID
ID = Trim(Request.QueryString("ID"))
Page = Trim(Request.QueryString("page"))
IF NOT IsNumeric(Page) THEN Page = 1
Response.Write "<table border=0 width='100%' id='table1'>" & vbCrLf
VisSideListe rs("id"), Page
Response.Write "</table>" & vbCrLf
Conn.Close
Set Conn = Nothing
end sub
Sub VisSideListe(ByVal ID, ByVal iPage)
Dim sAddline, rSQL, rs, X, iNbTotalPosts, sHTML
rSQL = "SELECT * FROM albums WHERE id2 = '" & Replace(ID,"'","´") & "' ORDER BY dato DESC"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.PageSize = MAX_LINES_PER_PAGE
rs.open rSQL, Conn, 1
IF rs.EOF OR rs.BOF) THEN
if iPage>1 then
Response.Write "<caption>Tom side</caption>" & vbCrLf
else
Response.Write "<caption>Tom liste</caption>" & vbCrLf
END IF
ELSE
iNbTotalPosts = rs.RecordCount
IF rs.RecordCount <> -1 THEN
rs.AbsolutePage = iPage
ELSE
X = 1
DO
rs.MoveNext
X=X+1
UNTIL rs.EOF OR X=((iPage-1)*MAX_LINES_PER_PAGE)
END IF
X = 1
DO WHILE NOT rs.EOF AND X <= MAX_LINES_PER_PAGE
VisSideListeLine rs, ID
rs.MoveNext
X = X + 1
LOOP
VisSideListeOversigt rs.RecordCount, MAX_LINES_PER_PAGE, iPage, ID
END IF
rs.close
SET rs = NOTHING
End Sub
Sub VisSideListeLine(rs2, ByVal ID)
beskrivelse = Trim(rs2("beskrivelse")&"")
filnavn = Trim(rs2("filnavn")&"")
Response.Write "<tr>"
Response.Write "<td align='left' width='112'>"
Response.Write "<a href='
http://www.pivskid.dk/images/users/"&filnavn&"' rel='lightbox[roadtrip]' title='"&beskrivelse&"'>"
Response.Write "<img src='
http://www.pivskid.dk/images/users/"&filnavn&"' width='112' height='112' style='filter: alpha(opacity=25)' onMouseOver='this.filters.alpha.opacity=100' onMouseOut='this.filters.alpha.opacity=25' alt='"&beskrivelse&"' /></a>"
IF Trim(ID & "") = Trim(Session("login") & "") THEN
Response.Write "<img border=0 src='iconer/delete.gif' width='44' height='14'>"
END IF
Response.Write "</tr>"
end sub
sub VisSideListeOversigt(ByVal TotalPages, ByVal PageLen, ByVal CurPage, ByVal ID)
Dim PageTotal, X
IF TotalPages < 0 THEN TotalPages = 0
PageTotal = 0
IF TotalPages > 0 THEN
PageTotal = TotalPages \ PageLen
IF TotalPages Mod PageLen Then PageTotal = PageTotal + 1
END IF
IF PageTotal > 1 THEN
IF CurPage <> 1 THEN
Response.Write SideListeLink(CurPage-1 , "<< Forrige", ID)
END IF
FOR X = 1 TO PageTotal
IF X <> CInt(CurPage) THEN
Response.Write SideListeLink(X, X, ID)
ELSE
Response.Write " <b>" & X & "</b>"
END IF
NEXT
IF CurPage <> PageTotal THEN
Response.Write SideListeLink(CurPage+1, "Næste >>", ID)
END IF
Response.Write vbCrLf
END IF
end sub
function SideListeLink(ByVal page, ByVal tekst, ByVal ID)
SideListeLink = " <a href='paging.asp?page=" & page & "&ID="&ID&"'>" & tekst & "</a>"
end function
%>
------------