ITPUB??ì3
ITPUB论坛 » Web开发 » ASP.NET与AJAX » 怎么样选出上一篇和下一篇


标题: 怎么样选出上一篇和下一篇
离线 mxd061203
初级会员



精华贴数 0
个人空间 0
技术积分 122 (14060)
社区积分 0 (1201671)
注册日期 2006-12-8
论坛徽章:0
      
      

发表于 2006-12-13 09:03 
怎么样选出上一篇和下一篇

表log

logid   title    content
15       "title001"  "content 110"
5       "title001"  "content 110"
445       "title001"  "content 110"
25       "title001"  "content 110"


select * from log where (logid =5)

怎么选择logid=5的上一篇,和下一篇


只看该作者    顶部
离线 zly526
一般会员



精华贴数 0
个人空间 0
技术积分 196 (9457)
社区积分 0 (1201639)
注册日期 2006-12-7
论坛徽章:1
开发板块每日发贴之星     
      

发表于 2006-12-13 09:04 
试试这样:


public string GetNextPhotoUrl(string id){
  string sql = "select top 1 id,PhotoUrl from 表名 where id>" + id + "order by id asc"
  return GetPhotoUrl(sql);
}

public string GetPreviousPhotoUrl(string id){
  string sql = "select top 1 id,PhotoUrl from 表名 where id<" + id + " order by id desc";
  return GetPhotoUrl(sql);
}


只看该作者    顶部
 
    

相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问