随机提取问题 [英] random fetching of questions
本文介绍了随机提取问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的先生/女士
i已经创建了一个测验网站.sir所有的东西都很好但是我发现有一个问题我想在我的网站上随机取问题问题列表我怎么能这样做先生
帮助我
我怎么能achiw = eve为每个学生随机取问题的目标让我有5个问题然后所有问题都显示给每个学生但是随机地
先生如何正确地写这个查询
dear sir/ma'am
i have created a quiz site .sir all things works well but one problem i found that i want to fetch questions randomly in my question list how can i do it sir
help me
how can i achiw=eve the goal to fetch questions randomly for each student let i have 5 question then all questions are shown to every student but randomly
sir how this query can be written correctly
SELECT *
FROM Quizquestion
WHERE (Quiz_Id = '1417')
ORDER BY ques_id RAND()
随机询问获取
我的问题代码是
random quesid fetch
my get question code is
str = "select * from quizdetails where quiz_id = '" & quizid & "'"
cmdly.rst1 = New DataTable
cmdly.rst1 = cmdly.executenonquery(str)
str = "select TOP 1 ques_id, question, correctoption, Quiz_Id from quizquestion where quiz_id = '" & quizid & "' ORDER BY NEWID()"
cmdly.rst2 = New DataTable
cmdly.rst2 = cmdly.executenonquery(str)
If cmdly.rst2.Rows.Count > 0 Then
lbquescnt.Text = quesid
lbques.Text = "Q. " & cmdly.rst2.Rows(0).Item("question").ToString
cmdly.rst3 = New DataTable
str = "select * from quizoption where quiz_id = '" & quizid & "' and ques_id = '" & cmdly.rst2.Rows(0).Item("ques_id") & "'"
cmdly.rst3 = cmdly.executenonquery(str)
If cmdly.rst3.Rows.Count > 0 Then
i = cmdly.rst3.Rows.Count
c = 0
quizlst.Items.Clear()
While c < i
Dim qlist As New System.Web.UI.WebControls.ListItem
qlist.Text = cmdly.rst3.Rows(c).Item("optionVALUE").ToString
qlist.Value = cmdly.rst3.Rows(c).Item("option_id").ToString
quizlst.Items.Add(qlist)
c = c + 1
End While
End If
End If
推荐答案
您的问题已经得到解答在其中 [ ^ ]
Your question has already been answered here[^]
这篇关于随机提取问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文