ASP真正随机不重复查询代码

来源:asp之家 时间:2010-01-02 20:40:00 

在网上找到的随机不重复查询代码:

select top 15 * from article where artshow=1 order by right(cstr(rnd(-int(rnd(-timer())*100+id)))*1000*Now(),2) 

发现一个问题:在access中执行正常,每次都不同。

但是在生成html时却不会变化,估计是服务器端没有销毁ado对象造成的,于是乎就弄出了这么一段真正随机不重复查询代码:

select top 15 title,author,content from article where id in(select top 15 id from article order by right(cstr(rnd(-int(rnd(-timer())*100+id)))*1000*Now(),2)) 


  用了这段代码后,每次生成html都不一样了。

标签:随机,不重复,sql,asp
0
投稿

猜你喜欢

  • Python在Matplotlib图中显示中文字体的操作方法

    2023-03-30 00:29:54
  • 一篇文章读懂Golang init函数执行顺序

    2024-04-27 15:40:37
  • 跟老齐学Python之print详解

    2021-02-06 03:32:56
  • matplotlib之pyplot模块坐标轴范围设置(autoscale(),xlim(),ylim())

    2022-03-15 09:01:16
  • js定时器怎么写?就是在特定时间执行某段程序

    2024-04-22 12:54:00
  • Django中信号signals的简单使用方法

    2023-08-18 08:49:49
  • SQLServer与服务器连接时出错的解决方案

    2009-06-28 14:35:00
  • python matplotlib绘制三维图的示例

    2023-03-04 16:35:48
  • python3用urllib抓取贴吧邮箱和QQ实例

    2022-05-15 16:25:18
  • opencv-python图像增强解读

    2022-10-10 04:29:16
  • 解析Golang中的GoPath和GoModule

    2024-05-09 14:56:48
  • Python基础之字符串操作常用函数集合

    2023-11-26 23:26:12
  • 详解Python3中yield生成器的用法

    2021-09-03 05:59:27
  • 三种在ES6中将非数组转换为数组的方法详情

    2024-04-16 08:55:06
  • Python使用UDP实现720p视频传输的操作

    2023-12-04 09:32:49
  • python 实现图像快速替换某种颜色

    2021-07-20 03:16:13
  • po+selenium+unittest自动化测试项目实战

    2022-05-03 14:46:46
  • python使用opencv切割图片白边

    2021-10-16 04:44:06
  • python-xpath获取html文档的部分内容

    2022-10-06 19:41:52
  • Tensorflow 定义变量,函数,数值计算等名字的更新方式

    2021-08-10 22:48:09
  • asp之家 网络编程 m.aspxhome.com