hi shree
am getting error as like above in this code at cmd1.ExecuteNonQuery();
if ((RadioButtonList1.SelectedValue) == dsCurrent.Tables[0].Rows[0]["CorrectOption"].ToString())
{
i++;
SqlCommand cmd1 = new SqlCommand("insert into StudentExamFullResult (UserID,Question,SelectedOption,CorrectOption) values('"+Label32.Text+"','" + dsCurrent.Tables[0].Rows[0]["Question"].ToString() + "','" + RadioButtonList1.SelectedValue + "','" + dsCurrent.Tables[0].Rows[0]["CorrectOption"].ToString() + "')", con);
cmd1.ExecuteNonQuery();
}
else
{
SqlCommand cmd1 = new SqlCommand("insert into StudentExamFullResult (UserID,Question,SelectedOption,CorrectOption) values('" +Label32.Text + "','" + dsCurrent.Tables[0].Rows[0]["Question"].ToString() + "','" + RadioButtonList1.SelectedValue + "','" + dsCurrent.Tables[0].Rows[0]["CorrectOption"].ToString() + "')", con);
cmd1.ExecuteNonQuery();
}
if ((RadioButtonList2.SelectedValue) == dsCurrent.Tables[0].Rows[1]["CorrectOption"].ToString())
{
i++;
SqlCommand cmd2 = new SqlCommand("insert into StudentExamFullResult (UserID,Question,SelectedOption,CorrectOption) values('" + Label32.Text + "','" + dsCurrent.Tables[0].Rows[1]["Question"].ToString() + "','" + RadioButtonList2.SelectedValue + "','" + dsCurrent.Tables[0].Rows[1]["CorrectOption"].ToString() + "')", con);
cmd2.ExecuteNonQuery();
}
manimala
Tejamanimala, if this helps please login to Mark As Answer. | Alert Moderator