在数据库中随机读取Mulitple记录并将其显示在Windows窗体上 [英] Reading Mulitple Records randomly in a database and displaying it on a windows forms

查看:119
本文介绍了在数据库中随机读取Mulitple记录并将其显示在Windows窗体上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好新来的!



我有一个问题,我希望这个网站上有人可以回答。我正在使用Visual C#构建数学应用程序,学生可以在这里进行数学测验,教程等。



关于构建我的数学测验,我决定做什么是在SQL服务器中构建一个表,它将保存特定主题的问题和答案。

例如,我在数据库中的一个表如下: -



表格名称:代数



栏目:QuestionId(主键),问题,答案,LevelOfDifficulty



我想要做的是从上表中提取RANDOM问题并将其显示在Windows窗体上。在这个窗口形式中,将有标签,其中包含我从数据库中的代数表中读取的问题,并且将有文本框,学生可以在其中回答问题



有人可以给我一个方法来构建这样的东西???

Hello guys new here!

I have a question that I hope someone here on this site can answer. I''m building an Math application in Visual C# where students can do math quizzes , tutorials etc.

With regards to building my math quizzes what I have decided to do is to build a table in SQL server that will hold questions and answers for a particular topic.
For example, one of the tables that I have in my database is as follows:-

Name of Table : Algebra

Columns : QuestionId (primary key) , Question, Answer, LevelOfDifficulty

What I want to do is to pull RANDOM questions from the above table and display them on a windows forms. In this windows form there will be labels which will hold the questions that I read from the ''Algebra'' table in the database and there will be text boxes where the student can answer the question

Can someone please give me a of a methodology to build something like this???

推荐答案

一种常见的方法是对一个合理的随机排序价值,例如 ORDER BY NEWID()
One common way is to sort on a reasonably random value, e.g. ORDER BY NEWID()


这篇关于在数据库中随机读取Mulitple记录并将其显示在Windows窗体上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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