以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 降序怎么排? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=125791) |
-- 作者:石四 -- 发布时间:2018/10/7 11:50:00 -- 降序怎么排? 升序代码: cmd.CommandText = "Sele ct top " & pagerows & " [_Identify], [_Identify] As 编号,[客户ID],[产品ID],[数量],[单价],[折扣] ,[数量]*[单价]*(1-[折扣]) as 金额 From {订单} where " If flt > "" Then cmd.CommandText &= iif(page=0, "1=1 and " & flt , "[_Identify] not In (Sele ct top " & pagerows * page & " [_identify] from {订单} where " & flt & " order by [_identify]) And " & flt & " order by [_Identify]") Else cmd.CommandText &= iif(page=0, "1=1" , "[_Identify] not In (Sele ct top " & pagerows * page & " [_identify] from {订单} order by [_identify]) order by [_Identify]") End If 降序代码加上DESC: cmd.CommandText = "Sele ct top " & pagerows & " [_Identify], [_Identify] As 编号,[客户ID],[产品ID],[数量],[单价],[折扣] ,[数量]*[单价]*(1-[折扣]) as 金额 From {订单} where " If flt > "" Then cmd.CommandText &= iif(page=0, "1=1 and " & flt , "[_Identify] not In (Sele ct top " & pagerows * page & " [_identify] from {订单} where " & flt & " order by [_identify] DESC) And " & flt & " order by [_Identify] DESC") Else cmd.CommandText &= iif(page=0, "1=1" , "[_Identify] not In (Sele ct top " & pagerows * page & " [_identify] from {订单} order by [_identify] DESC) order by [_Identify] DESC") End If 结果打开第一页仍按升序排列,从第二页开始才正常按降序排列,怎么办?代码看不懂,不和怎么改 |
-- 作者:石四 -- 发布时间:2018/10/7 11:52:00 -- 就是说多出一个首页,怎么才能把这多余的首页去除? |
-- 作者:有点蓝 -- 发布时间:2018/10/7 12:01:00 -- 降序代码加上DESC: cmd.CommandText = "Sele ct top " & pagerows & " [_Identify], [_Identify] As 编号,[客户ID],[产品ID],[数量],[单价],[折扣] ,[数量]*[单价]*(1-[折扣]) as 金额 From {订单} where " If flt > "" Then cmd.CommandText &= iif(page=0, "1=1 and " & flt & " order by [_identify] DESC" , "[_Identify] not In (Sele ct top " & pagerows * page & " [_identify] from {订单} where " & flt & " order by [_identify] DESC) And " & flt & " order by [_Identify] DESC") Else cmd.CommandText &= iif(page=0, "1=1 order by [_identify] DESC" , "[_Identify] not In (Sele ct top " & pagerows * page & " [_identify] from {订单} order by [_identify] DESC) order by [_Identify] DESC") End If |
-- 作者:石四 -- 发布时间:2018/10/7 14:02:00 -- OK!可以上线试用了,谢谢蓝版 |