1
Answer

What would I do To debug this program?

Ask a question

private void Button1_Click(object sender, System.EventArgs e)

{

try

{

if(Button1.Text=="edit")

{

MessageBox.Show("edit the record");

Button1.Text="save";

}

else

if (Button1.Text=="Save")

{

oleDbConnection1.Open();

String sql="Update scorecard set departement='"+TextBox3.Text+"' where pincode='"+TextBox1.Text+"'";

try

{

oleDbUpdateCommand1.CommandText=sql;

oleDbUpdateCommand1.ExecuteNonQuery();

MessageBox.show("Record updated");

oleDbConnection1.Close();

Button1.Text="Edit";

}

catch (Exception errData)

{

MessageBox.Show(errData.ToString());

}

}

}

catch (Exception errData)

{

MessageBox.Show(errData.ToString());

}

}

}

}


What wolud be the problem? Iwant This button to update data in data base but It'failed to debug.
 The type or namespace name 'MessageBox' could not be found (are you missing a using directive or an assembly reference?)


Answers (1)