如何随机化每个回发的数据源 [英] how to randomize the datasource for every postback

查看:115
本文介绍了如何随机化每个回发的数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何随机化每个回发的数据源.

解决方案

请提供详细信息....

我想您想在表格或其他内容中显示随机帖子(或文章).这样您每次回发后都将始终获得新数据.



您具有不同的数据集或数据表,并且您想要设置它们中的任何一个

使用随机函数(min,max)并使用数据表的索引作为最小值和最大值

您的问题非常模糊.我会尝试回答,如果我未能正确回答,那是因为您的问题根本不清楚.

要从数据库中选择随机数据,请执行以下操作:

  SELECT   TOP   10    FROM  表格
订单  BY  NEWID()



假设您要10条记录,否则相应地进行更改.而且您可以列出任意多的列,或者如果需要的话可以使用*.


how to randomize the datasource for every postback.

解决方案

Please give details....

I think you want to show random posts(or articles) in the grid or something. so that you will always get new data after every postback.

or

you have different datasets or datatables and you want to set any one of them

use random function(min,max) and use datatable''s indexes as min and max values


Your question is very vague. I''ll try to answer it, if I fail to answer it properly, it will be because your question is not clear at all.

To select random data from your database, do this:

SELECT TOP 10 column FROM table
ORDER BY NEWID()



That''s assuming you want 10 records, otherwise change accordingly. And you can list as many columns as you like, or use *, if you must.


这篇关于如何随机化每个回发的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆