Previous, next process code

xiaoxiao2021-03-06  36

REM == Previous ==

REM =============================================================================================================================================================================== ================

REM = Parameter Description:

Rem = PID Current ID, PRAME: Bar Currently (such as general web_news table, the field is usually WN _ **, PRAME represents WN)

REM = PTABLE (in front of the table. If the normal table name is: Site name _ table name (Shenzhe_News) PTable: On behalf of Shenzhe)

Rem = Description: Adopting the above naming method to make the process reachable

REM =============================================================================================================================================================================== ==============

Function GetPre (PID, PRAME, PTABLE)

ID = Prame & "_ id"

Title = Prame & "_ Title"

Table = "city _" & ptable

URL = "show _" & PTABLE

SQL = "SELECT TOP 1" & Id & "& Title &" From "& Table &" Where "& id &" <"& pid &" order by "& id &" desc "

SET RS = Conn.execute (SQL)

IF f.eof or rs.bof dam

Pre = "Previous: No news"

Else

pre = "&" & r (1) & ""

END IF

Getpre = pre

END FUNCTION

Rem = Next

REM ==============

REM = parameter letter is the same

REM ==========

Function GetNext (NID, NRAME, NTABLE)

ID = nrame & "_ id" title = nrame & "_ title"

Table = "City _" & ntable

URL = "show _" & ntable

SQL = "SELECT TOP 1" & Id & "& Title &" From "& Table &" WHERE "& ID &" & NID & "ORDER BY" & Id & "

SET RS = Conn.execute (SQL)

IF f.eof or rs.bof dam

NNEXT = "Next: No news"

Else

NNEXT = "" "& r (1) &" "

END IF

Getnext = nNext

END FUNCTION

Implement code:

The dual database has a table:

City_Active City_date city_note

City_Active main fields are: ca_id, cd_title

City_date The main fields are: cd_id, cd_title

The city_note main fields are: CN_ID, CN_TITLE

This is available in this:

Quote in Show_note.asp? CN_ID = 4 Next

<% = Getpre (CN_ID, "CN", "Note")%> 'Previous

<% = GetNext (CN_ID, "CN", "Note")%> 'Next

转载请注明原文地址:https://www.9cbs.com/read-66843.html

New Post(0)