上一篇、下一篇函数
时间:2010-10-11 来源:mx11
<%
'定义一个nextrs函数来找出下一篇的ID
function nextrs
nextrsd=server.CreateObject("adodb.recordset")
sql="select top 1 * from Product where Product_id>"&request("Product_id")&" order by Product_id"
set nextrsd=conn.execute(sql)
if nextrsd.eof then
response.Write "已经是最后一个产品 "
else
id1=nextrsd("Product_id")
response.Write "<a href='product.asp?action=view&id="&id1&"'' class='ad'><strong>下一产品</strong></a> "
end If
nextrsd.close
end function '定义一个backrs函数来找出上一篇的ID
function backrs
backrsd=server.CreateObject("adodb.recordset")
sql="select top 1 * from Product where Product_id<"&request("Product_id")&" order by Product_id desc"
set backrsd=conn.execute(sql)
if backrsd.eof then
response.Write "已经是第一个产品"
else
id2=backrsd("Product_id")
response.Write "<a href='product.asp?action=view&id="&id2&"' class='ad'><strong>上一产品</strong></a>"
end If
backrsd.close
end function
%>
'定义一个nextrs函数来找出下一篇的ID
function nextrs
nextrsd=server.CreateObject("adodb.recordset")
sql="select top 1 * from Product where Product_id>"&request("Product_id")&" order by Product_id"
set nextrsd=conn.execute(sql)
if nextrsd.eof then
response.Write "已经是最后一个产品 "
else
id1=nextrsd("Product_id")
response.Write "<a href='product.asp?action=view&id="&id1&"'' class='ad'><strong>下一产品</strong></a> "
end If
nextrsd.close
end function '定义一个backrs函数来找出上一篇的ID
function backrs
backrsd=server.CreateObject("adodb.recordset")
sql="select top 1 * from Product where Product_id<"&request("Product_id")&" order by Product_id desc"
set backrsd=conn.execute(sql)
if backrsd.eof then
response.Write "已经是第一个产品"
else
id2=backrsd("Product_id")
response.Write "<a href='product.asp?action=view&id="&id2&"' class='ad'><strong>上一产品</strong></a>"
end If
backrsd.close
end function
%>
相关阅读 更多 +