ASP implementation of the last article, the next process code

Source: Internet
Author: User
Tags table name


-

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
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.