最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
上一篇,下一篇过程代码
时间:2026-09-19 19:40:02 编辑:袖梨 来源:一聚教程网
Rem==上一篇== Rem================================================================ Rem=参数说明: Rem=pid当前ID,prame:栏目前辍(如一般web_news表,字段时一般为wn_**,prame就代表wn) Rem=ptable(表前辍.如一般表名是:站点名_表名(shenzhe_news)ptable:就代表shenzhe) Rem=说明:采用上面命名法,可使该过程达到通用 Rem=============================================================== FunctionGetPre(pid,prame,ptable) id=prame&"_id" title=prame&"_title" table="city_"&ptable url="show_"&ptable sql="SELECTTOP1"&id&","&title&"FROM"&table&"WHERE"&id&"<"&pid&"ORDERBY"&id&"DESC" setrs=Conn.Execute(sql) Ifrs.eoforrs.bofThen pre="上一篇:没有新闻了" Else pre="<ahref="&url&".asp?"&id&"="&rs(0)&">"&rs(1)&"</a>" EndIf GetPre=pre EndFunction Rem=下一篇 Rem============= Rem=参数函意和上过程一样 Rem========== FunctionGetNext(nid,nrame,ntable) id=nrame&"_id" title=nrame&"_title" table="city_"&ntable url="show_"&ntable sql="SELECTTOP1"&id&","&title&"FROM"&table&"WHERE"&id&">"&nid&"ORDERBY"&id&"" setrs=Conn.Execute(sql) Ifrs.eoforrs.bofThen nnext="下一篇:没有新闻了" Else nnext="<ahref="&url&".asp?"&id&"="&rs(0)&">下一篇:"&rs(1)&"</a>" EndIf GetNext=nnext EndFunction 实现代码: 偶数据库里有表: city_activecity_datecity_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")%>'下一篇