public void update(MOduleQuestion moduleq)
{
string mcode = moduleq.getModuleCode();
int QNo = moduleq.getQuestionNo();
string Question = moduleq.getQuestion();
string OPt1 = moduleq.getOP1();
string OPt2 = moduleq.getOP2();
string OPt3 = moduleq.getOP3();
string OPt4 = moduleq.getOP4();
string Answer = moduleq.getAnswer();
try
{
string sql = "Update Module_Question SET Question = @question, Option1 = @opt1, Option2 = @opt2, Option3 = @opt3, Option4 = @opt4, Answer = @answer WHERE MQ_Module_Code = @mcode and MQ_Question_No = @qno";
SqlCommand cmd = new SqlCommand(sql, m_con);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Parameters.AddWithValue("@mcode", mcode);
cmd.Parameters.AddWithValue("@qno", QNo);
cmd.Parameters.AddWithValue("@question", Question);
cmd.Parameters.AddWithValue("@opt1", OPt1);
cmd.Parameters.AddWithValue("@opt2", OPt2);
cmd.Parameters.AddWithValue("@opt3", OPt3);
cmd.Parameters.AddWithValue("@opt4", OPt4);
cmd.Parameters.AddWithValue("@answer", Answer);
m_con.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Question Record Updated Successfully", "lecture Reg System", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
m_con.Close();
}
}