随机获取问题 [英] Fetch randomly questions

查看:50
本文介绍了随机获取问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从.net 3.5中的数据库中随机提取问题.

我需要一个测验应用程序.所有问题都保存在数据库中,我必须随机选择并在屏幕上显示.

我的意思是针对不同用户的问题.
请帮帮我.
非常感谢.

How to Fetch randomly questions from database in .net 3.5.

i need it for a quiz application.In it all the question are saved in the database and i have to select randomly and have to show on the screen.

I mean different question for different user.
please help me .
Thanks a lot.

推荐答案

将所有问题存储在数据库中,然后从数据库中随机提取.
假设您有一个名为 Question 的sql表,这是用于选择随机问题的查询.

Store all Questions in database and then fetch it randomly from database.
suppose you have sql table named Question, here is the Query to select random Questions.

SELECT TOP 1 * FROM Question ORDER BY NEWID()


使用 Random [ ^ ]类生成数据库密钥.
Use the Random[^] class to generate your database key.


这篇关于随机获取问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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