如何从asp.net中的数据库中检索数据 [英] how to retrive data from database in asp.net

查看:201
本文介绍了如何从asp.net中的数据库中检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有10个问题,我想随机检索数据数据库.
列为 que,a,b,c,d,正确答案.总共6列

这些是我的专栏,其中提取问题以及选项和答案.
现在我想随机检索它并将其显示在设计part.so中,我需要编写什么查询.....

i have 10 questions in data base and i want to retrive the data database randomly.
the columns are que,a,b,c,d,correct answer.total 6 columns

these are my columns in which questions as well as options and answers are fetched.
now i want to retrive it randomly and display it in design part.so what query i need to write.....

推荐答案

也许,像这样的简单使用查询:

Maybe, simple use query like that:

SELECT * FROM table ORDER BY RAND() LIMIT 1



RandomSelection1 [ ^ ]
RandomSelection2 [
Hi,
RandomSelection1[^]
RandomSelection2[^]


尝试此查询
Try this query
select top 20 percent * from tableName order by newid()



tableName =您的表名



tableName = your table name


这篇关于如何从asp.net中的数据库中检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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