国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

上一篇,下一篇過程代碼

2020-07-27 13:12:06
字體:
供稿:網(wǎng)友
Rem==上一篇==
Rem================================================================ Rem= 參數(shù)說明:
Rem= pid當(dāng)前ID,prame:欄目前輟(如一般web_news表,字段時(shí)一般為wn_**,prame就代表wn)
Rem= ptable(表前輟.如一般表名是:站點(diǎn)名_表名(shenzhe_news) ptable:就代表shenzhe)
Rem= 說明:采用上面命名法,可使該過程達(dá)到通用
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 = "上一篇:沒有新聞了"
Else
     pre = "<a href="&url&".asp?"&id&"="&rs(0)&">"&rs(1)&"</a>"
End If
GetPre = pre
End Function

Rem = 下一篇
Rem=============
Rem= 參數(shù)函意和上過程一樣
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 = "下一篇:沒有新聞了"
Else
     nnext = "<a href="&url&".asp?"&id&"="&rs(0)&">下一篇:"&rs(1)&"</a>"
End If
GetNext = nnext
End Function

實(shí)現(xiàn)代碼:
偶數(shù)據(jù)庫里有表:
city_active  city_date  city_note
city_active主要字段有: ca_id,cd_title
city_date主要字段有: cd_id,cd_title
city_note主要字段有: cn_id, cn_title

這樣引用就可:
在show_note.asp?cn_id=4里引用上一篇下一篇
<%=GetPre(cn_id,"cn","note")%> ' 上一篇
<%=GetNext(cn_id,"cn","note")%> ' 下一篇
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 丹寨县| 建瓯市| 新河县| 马公市| 焦作市| 石阡县| 渭源县| 乐清市| 湟中县| 齐河县| 华蓥市| 政和县| 大悟县| 剑川县| 文昌市| 凌海市| 长岭县| 永清县| 扬中市| 长沙县| 昌平区| 娄底市| 乌鲁木齐县| 遂宁市| 昔阳县| 大理市| 和静县| 江源县| 双柏县| 沂南县| 慈利县| 丹棱县| 南郑县| 攀枝花市| 武乡县| 正宁县| 新兴县| 阿克陶县| 永康市| 南阳市| 九龙坡区|