我应该如何将 sql 表中的所有行与“主记录”进行比较?使用vb.net?
举例来说,这是一个测验,其中不同学生的答案已加载到数据库中。在包含各种学生答案的各种学生条目的表格内部,有一行“masterentry”包含所有正确答案。
我想做的是编写一个按钮,该按钮将在单击时拉动主行并将所有其他行与其进行比较。从第一行开始,每次该列与主条目匹配时,都会将 1 点分配给声明的整数。当该行被完全读取后,整数将存储在“总点数”列中。然后它继续到下一行答案。
我希望我的措辞方式有意义,如果有更简单的方法,我愿意接受建议。我真的不需要任何帮助来建立与 sql 数据库的连接。任何帮助将不胜感激,提前感谢任何人的时间。如果有帮助,我可以提供更多详细信息。
Let's say, for example, this is a quiz where the answers are already loaded into a database from different students. Inside of the table with various student entries containing various student's answers there is a row "masterentry" with all of the correct answers.
What I would like to do is code a button that will pull the master row on click and compare every other row against it. Starting with the first row, every time the column matches the master entry 1 point is assigned to a declared integer. When the row has completely been read the integer is stored in a "totalpoints" column. Then it moves on to the next row of answers.
I hope this makes sense the way I worded it, if there is an easier way to go about it I am open to suggestions. I don't really need any help establishing the connection to the sql database. Any help would be greatly appreciated, thanks in advance for anyone's time. I can provide more details if it would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是基于模糊的模式想法的粗略猜测。您只需从 .NET 调用此查询(最好存储在存储过程中,传入
@QuizID
),除非您确实希望在将所有数据拉取到客户端后通过循环来降低效率。 ..根据数据类型,这里可能有一些快捷方式。例如,如果测验是对/错,您可以采取一些小技巧来减少
...
部分。Just a rough guess based on vague idea of schema. You would just call this query from .NET (preferably stored in stored procedure, passing in a
@QuizID
) unless you really want to do it less efficiently by looping after pulling all of the data to the client...There may be some shortcuts here based on the data types. E.g. if the quiz is true/false there are some little tricks you can do to reduce the
...
part.