1. 程式人生 > >上一條 下一條 例項程式碼!

上一條 下一條 例項程式碼!

請特別關注紅色的字母,不然會出錯!

dim showprev
     set showprev=conn.execute("select top 1 * from jcl_photo where id > "&id&" order by id asc;")
     if showprev.eof then
     response.Write "上條沒有了"
     else
     response.Write "<a href=""sub.asp?id="&showprev("id")&""">上一條</a>|||||"
     end if
     showprev.close
     set showprev=nothing
    dim shownext
     set shownext=conn.execute("select top 1 * from jcl_photo where id < "&id&" order by id DESC;

")
     if shownext.eof then
     response.Write "下條沒有了"
     else
     response.Write "<a href=""sub.asp?id="&shownext("id")&""">下一條</a>"
     end if
     shownext.close
     set shownext=nothing