美术馆和艺术馆:asp下一条复杂要求

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/08 01:49:20
文件名 ID
LF5101 22
LF5102 24
LF5103 23

我现在当显示ID22 LF5101时下一条是LF5103 23,而我想要的是LF5102 24

我现在的写法如下:
'上一产品
Set RsPre = Server.CreateObject("ADODB.RecordSet")
StrSql="select * from Product where ( Product_lx='"&Rs("Product_lx")&"' and id < "&Rs("id")&" ) order by id desc"
RsPre.open StrSql,Conn,1,1
If not RsPre.Eof then
Previous="<a href=Cp.asp?id="&RsPre("id")&"><b><font color=0000FF><U>Previous Model</U></font></b></a>"
Else
Previous="<b><font color=0000FF><U>Previous Model</U></font></b>"
End If
RsPre.close
set RsPre=nothing
'下一产品
Set RsNex = Server.CreateObject("ADODB.RecordSet")
StrSql="select * from Product where ( Product_lx='"&Rs("Product_lx")&"' and id > "&Rs("id")&" ) order by Product_Px Asc,Product_title asc,Product_up_date desc"
RsNex.open StrSql,Conn,1,1
If not RsNex.Eof then
Nex="<a href=Cp.asp?id="&RsNex("id")&"><b><font color=0000FF><U>Next Model</U></font></b></a>"
Else
Nex="<b><font color=0000FF><U>Next Model</U></font></b>"
End If
RsNex.close
set RsNex=nothing

库结构不合理吧,产品有统一格式的编号,但因添加顺序的原因,造成产品编号与ID不协调,你排序的是添加顺序而不是产品编号顺序。这里的ID根本就用不着了,而且就是造成麻烦的原因,为什么还要用呢,用其它标识,或者再设一个排序字段吧。

是不是在库里边是你开始说的那个顺序呀?如果是那样的话.你不按ID排序不就可以了吗.