08. juni 2001 - 23:46Der er
42 kommentarer og 1 løsning
Vis 10 poster og klik for at vise næste 10
Jeg er ved at lave en lille system, og vil have lavet den sådan at man ser de 10 nyeste poster. Under de poster skal man så kunne klikke for at se de ti næste eller nu de ti forrige.
Håber nogen kan hjælpe......
her er mit script: <% dim Connection,SQLstringK,KRS Set Connection = Server.CreateObject(\"ADODB.Connection\") Connection.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\"&Server.MapPath(\"../test.mdb\") SQLstringK=\"select * from appz ORDER BY dato DESC\" SET KRS=Connection.Execute(SQLstringK) %> <%while not KRS.EOF%> <%=KRS(\"name\")%> <%
KRS.MoveNext wend
KRS.close set KRS =nothing connection.close set connection = nothing
Prøv dette: <% intPage = Request(\"page\") If isNumeric(intPage) = False Or intPage < 1 Then intPage = 1 End If %> <% dim Connection,SQLstringK,KRS Set Connection = Server.CreateObject(\"ADODB.Connection\") Connection.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\"&Server.MapPath(\"../test.mdb\") SQLstringK=\"select * from appz ORDER BY dato DESC\" SET KRS=Connection.Execute(SQLstringK) %> <% If Not (rs.BOF Or rs.EOF) Then rs.PageSize = 10 rs.AbsolutePage = intPage intRecCount = rs.PageSize intPageCount = rs.PageCount %> <%while not KRS.EOF%> <%=KRS(\"name\")%> <% KRS.MoveNext wend
KRS.close set KRS =nothing connection.close set connection = nothing %> <form method=\"GET\" action=\"pro-nyt.asp\"><% Response.Write \"Gå til side \" For intNum = 1 To intPageCount Response.Write \"<input type=submit value=\" & intNum & \" name=page class=knap id=knap>\" Next %></form>
Nej brug denne: <% intPage = Request(\"page\") If isNumeric(intPage) = False Or intPage < 1 Then intPage = 1 End If %> <% dim Connection,SQLstringK,KRS Set Connection = Server.CreateObject(\"ADODB.Connection\") Connection.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\"&Server.MapPath(\"../test.mdb\") SQLstringK=\"select * from appz ORDER BY dato DESC\" SET KRS=Connection.Execute(SQLstringK) %> <% If Not (KRS.BOF Or KRS.EOF) Then KRS.PageSize = 10 KRS.AbsolutePage = intPage intRecCount = KRS.PageSize intPageCount = KRS.PageCount %> <%while not KRS.EOF%> <%=KRS(\"name\")%> <% KRS.MoveNext wend
KRS.close set KRS =nothing connection.close set connection = nothing %> <form method=\"GET\" action=\"pro-nyt.asp\"><% Response.Write \"Gå til side \" For intNum = 1 To intPageCount Response.Write \"<input type=submit value=\" & intNum & \" name=page class=knap id=knap>\" Next %></form>
i toppen af siden har jeg lagt: <%option explicit%> <% intPage = Request(\"page\") If isNumeric(intPage) = False Or intPage < 1 Then intPage = 1 End If %> <% dim Connection,SQLstringK,KRS Set Connection = Server.CreateObject(\"ADODB.Connection\") Connection.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\"&Server.MapPath(\"../test.mdb\") SQLstringK=\"select * from appz ORDER BY dato DESC\" SET KRS=Connection.Execute(SQLstringK) %> <% If Not (KRS.BOF Or KRS.EOF) Then KRS.PageSize = 10 KRS.AbsolutePage = intPage intRecCount = KRS.PageSize intPageCount = KRS.PageCount %>
try this: <% intPage = Request(\"page\") If isNumeric(intPage) = False Or intPage < 1 Then intPage = 1 End If %> <% dim Connection,SQLstringK,KRS Set Connection = Server.CreateObject(\"ADODB.Connection\") Connection.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\"&Server.MapPath(\"../test.mdb\") SQLstringK=\"select * from appz ORDER BY dato DESC\" SET KRS=Connection.Execute(SQLstringK) %> <% If Not (KRS.BOF Or KRS.EOF) Then KRS.PageSize = 10 KRS.AbsolutePage = intPage intRecCount = KRS.PageSize intPageCount = KRS.PageCount %> <%while not KRS.EOF%> <%=KRS(\"name\")%> <% intRecCount = intRecCount - 1 KRS.MoveNext wend end if
KRS.close set KRS =nothing connection.close set connection = nothing %> <form method=\"GET\" action=\"pro-nyt.asp\"><% Response.Write \"Gå til side \" For intNum = 1 To intPageCount Response.Write \"<input type=submit value=\" & intNum & \" name=page class=knap id=knap>\" Next %></form>
Takker for dine point. Jeg sad i går i over en time og prøvede at få det til at virke men det lykkedes ikke. Desuden er 20 point alt for lidt til denne slags spørgsmål.
hvad med at indsætte det kode som du bruger på din side !! (paging)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.