-
rem== previous = =
rem======================================================
rem= parameter description:
rem= PID current id,prame: column prefix (such as the General Web_news table, when the field is generally the wn_**,prame on behalf of WN)
rem= ptable (table prefix. If the general table name is: Station name _ table names (shenzhe_news) ptable: On behalf of Shenzhe)
rem= Note: The above naming method enables the process to reach Universal
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 rs.eof or Rs.bof Then
Pre = "Previous: no News"
Else
Pre = "<a href=" &url& ". asp?" &id& "=" &rs (0) & ">" &rs (1) & "</a>"
End If
Getpre = Pre
end Function
Rem = the next
rem=============
rem= parameter letter is the same as on the procedure
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 rs.eof or rs.bof Then
NNext = "Next: no News"
Else
NNext = " <a href= "&url&". asp? " &id& "=" &rs (0) & "> Next:" & RS (1) & "</a>"
End If
GetNext = NNext
End Function
Implementation code:
I have tables in my database:
city_active city_date city_note
city_active primary fields are: Ca_id,cd_title
City_ The date Primary fields are: Cd_id,cd_title
City_note primary fields are: cn_id, cn_title
This reference can be:
in the show_note.asp?cn_id=4 quoted in the next article
<%=getpre (cn_id, "cn", "note")%> ' previous
<%=getnext (cn_id, "cn", "note")%> ' next