代码:
using (var connection = new MySqlConnection(connectionString))
using (var command = connection.CreateCommand())
{
command.CommandText = "SELECT * from question WHERE question_id='10'" ;
connection.Open();
using (var reader = command.ExecuteReader())
{
while (reader.Read()) ;
label1.Text = reader["question"].ToString();
radioButton1.Text = reader["option1"].ToString();
radioButton2.Text = reader["option2"].ToString();
radioButton3.Text = reader["option3"].ToString();
radioButton4.Text = reader["option4"].ToString();
}
}
我想从这些单选按钮中检查正确答案,我的数据库中有一个列,其中包含每组问题的正确答案的值,我如何获取它,我是这些语言的新手。