its just giving right for wrong, and viceversa
private void answer()
{
string Answer;
int score = 0;
SqlConnection con = new SqlConnection();
string cmd2= "SELECT Answer FROM Questions
con.ConnectionString = constring;
SqlCommand cmdn = new SqlCommand(cmd2, con);
//SqlDataAdapter sda = new SqlDataAdapter(cmd2, conn);
try
{
con.Open();
SqlDataAdapter sda = new SqlDataAdapter(cmd2, con);
DataTable dtb = new DataTable();
SqlDataReader Reader = cmdn.ExecuteReader();
if (radioButton1.Checked == true)
{
Answer = radioButton1.Text;
radioButton1.Checked = false;
}
else if (radioButton2.Checked == true)
{
Answer = radioButton2.Text;
radioButton2.Checked = false;
}
else if (radioButton3.Checked == true)
{
Answer = radioButton3.Text;
radioButton3.Checked = false;
}
else if (radioButton4.Checked == true)
{
Answer = radioButton4.Text;
radioButton4.Checked = false;
}
else { Answer = ""; }
if (Answer == label3.Text)
{
MessageBox.Show("your answer is correct");
}
else
{
MessageBox.Show("your answer in incorrect");

Stella Bloom15 reputationPosted Jul 27, 2017, 11:03 AM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Jul 26, 2017, 8:36 PM EDT