上一篇,下一篇過(guò)程代碼
更新時(shí)間:2007年02月10日 00:00:00 作者:
復(fù)制代碼 代碼如下:
Rem==上一篇==
Rem================================================================
Rem= 參數(shù)說(shuō)明:
Rem= pid當(dāng)前ID,prame:欄目前輟(如一般web_news表,字段時(shí)一般為wn_**,prame就代表wn)
Rem= ptable(表前輟.如一般表名是:站點(diǎn)名_表名(shenzhe_news) ptable:就代表shenzhe)
Rem= 說(shuō)明:采用上面命名法,可使該過(guò)程達(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 = "上一篇:沒(méi)有新聞了"
Else
pre = "<a href="&url&".asp?"&id&"="&rs(0)&">"&rs(1)&"</a>"
End If
GetPre = pre
End Function
Rem = 下一篇
Rem=============
Rem= 參數(shù)函意和上過(guò)程一樣
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 = "下一篇:沒(méi)有新聞了"
Else
nnext = "<a href="&url&".asp?"&id&"="&rs(0)&">下一篇:"&rs(1)&"</a>"
End If
GetNext = nnext
End Function
實(shí)現(xiàn)代碼:
偶數(shù)據(jù)庫(kù)里有表:
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")%> ' 下一篇
相關(guān)文章
Coolite 中前臺(tái)獲取 GridPanel 當(dāng)前選擇行值的代碼
掌握獲取 GridPanel 當(dāng)前行的各個(gè)字段值的方法,需要的朋友可以參考下。2010-06-06asp 實(shí)現(xiàn)對(duì)SQL注入危險(xiǎn)字符進(jìn)行重編碼處理的函數(shù)
asp 實(shí)現(xiàn)對(duì)SQL注入危險(xiǎn)字符進(jìn)行重編碼處理的函數(shù)...2007-08-08ASP 使用jqGrid實(shí)現(xiàn)讀寫(xiě)刪的代碼(json)
因?yàn)橛辛吮容^成型的CMS,一直沒(méi)有舍棄ASP,一直想用.net重寫(xiě)一下,是后話了。2010-03-03asp cookie中文Javascript取得中文cookie
這篇文章主要介紹了asp cookie中文Javascript取得中文cookie,原理就是將中文編碼改成UTF-8編碼格式,傳到前臺(tái),再用JS將其解碼2014-07-07檢查access數(shù)據(jù)庫(kù)中是否存在某個(gè)名字的表的asp代碼
首先調(diào)用adodb.connection對(duì)象中的openSchema函數(shù),這樣會(huì)得到一個(gè)Recordset,其中每一條“紀(jì)錄”對(duì)應(yīng)著數(shù)據(jù)庫(kù)中的一張表,“紀(jì)錄”的每個(gè)“字段”包含了對(duì)應(yīng)表的某方面信息。其中TABLE_NAME字段包含了對(duì)應(yīng)表的名稱2009-06-06在ASP中不用模板生成HTML靜態(tài)頁(yè)直接生成.html頁(yè)面
有沒(méi)有辦法不用模板,如一個(gè)正常的htmer.asp頁(yè)面,直接生成為htmer.html頁(yè)面呢?當(dāng)然是可以的,而且非常簡(jiǎn)單,今天就教大家在ASP中不用模板生成HTML靜態(tài)頁(yè)的方法2014-09-09