There have been many friends asking me, IT365cn.com articles implement "Previous", "Next" effect? Because I have been busy writing IT365CN forums, I can't provide friends with code in the station in time. Girlish idle, work, simply introduce the implementation ASP code. In the past, I used to use the source code of a website. It is the way to use ID 1 and ID-1. In the actual use process, find a problem: When an article in the database is deleted, it will cause the ID discontinuous. If you use ID 1 and ID-1 to determine if it is found to be recorded. So the program is not very perfect. In the ASP code we introduced, it is to find the next ID that is larger than the first record greater than the current ID, querying the first record smaller than the current ID to find the previous ID, so even if the ID It can also be displayed normally without continuous. (The program code is also the brief introduction method for the Classic Forum Related Posts: Data Table Articles There is ID (article ID), title (article title), Content (article content), addtime, etc. Other related fields. <% `Define a NEXTRS function to find the next id function next (" AdoDB) .recordset ") SQL =" SELECT TOP 1 * from Articles WHERE ID> "& A1 &" Order BY ID "set next/10.execute (SQL) if nextrsd.eof deathRESPONSE.WRITE" Next: This is this classification The last article "Elsea2 = NEXTRSD (" ID ") response.write" Next: "end ifend function
`Define a backrs function to find the previous IDFunction BackrsBackRSD = Server.createObject (" AdoDb.Recordset ") SQL =" SELECT TOP 1 * from Articles WHERE ID <"& A1 &" Order By ID DESC "set back barrsd = conn. EXECUTE (SQL) ife.write "Previous: This is the first article under this category" ELSEA0 = BACKRSD ("ID") Response.write "Previous: