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?)
shekhar pawarPosted Nov 28, 2006, 6:37 AM
Hi,
First of all you need to create instance of MessageBox().
Like,
MessageBox msg=new MessageBox();
then use this msg as,
msg.Show("edit the record");
Use same for all.