.求高人 给予解决办法....
但是必须要加上ChannelID=1这个条件..但是分页不成功
如果去掉ChannelID=1这个条件的话分页算法是对的Select Top 20 * from gov_news where ChannelID=1 id
not in(select top 40 id from gov_news order by id asc) order by id asc
这是我的 sql语句
asp.net 分页算法 sql语句实现的问题 求高人
答案:4 悬赏:60 手机版
解决时间 2021-03-14 17:37
- 提问者网友:我一贱你就笑
- 2021-03-14 07:32
最佳答案
- 五星知识达人网友:我住北渡口
- 2021-03-14 08:30
Select Top 20 * from gov_news where id
not in(select top 40 id from gov_news where ChannelID=1 order by id asc) and ChannelID=1 order by id asc
not in(select top 40 id from gov_news where ChannelID=1 order by id asc) and ChannelID=1 order by id asc
全部回答
- 1楼网友:患得患失的劫
- 2021-03-14 10:48
Select Top 20 * from gov_news where ChannelID=1 and id
not in(select top 40 id from gov_news order by id asc) order by id asc
是啊,少了AND
- 2楼网友:迷人又混蛋
- 2021-03-14 10:24
这句SQL 中间少了一个 AND
Select Top 20 * from gov_news where ChannelID=1 AND not id in(select top 40 id from gov_news order by id asc) order by id asc
- 3楼网友:七十二街
- 2021-03-14 09:51
public partial class _default : system.web.ui.page { protected void page_load(object sender, eventargs e) { sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings["houseconnectionstring"].connectionstring); sqlcommand cmd = new sqlcommand("select count(guid) from hire",conn); conn.open();
///获取总记录数 int num = convert.toint32(cmd.executescalar());
///将总记录数赋值给aspnetpager1对象 aspnetpager1.recordcount = num;
message.text = "总记录条数:" + num.tostring(); depeaterdatabind(); conn.close(); }
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯