how to datagridview update alert message

Please help

Junior Developer Asked on December 13, 2017 in C#.
Add Comment
1 Answer(s)

private void btn_UpdateData_Click(object sender, EventArgs e)
{
if (txt_name.Text != “” && txt_email.Text != “”)
{
sqlcmd = new SqlCommand(“update tbl_usermaster set name=@name,email=@email where id=@id”, conn);
conn.Open();
sqlcmd.Parameters.AddWithValue(“@id”, id);
sqlcmd.Parameters.AddWithValue(“@name”, txt_name.Text);
sqlcmd.Parameters.AddWithValue(“@email”, txt_email.Text);
sqlcmd.ExecuteNonQuery();
MessageBox.Show(“User data Updated Successfully..”);
conn.Close();
DisplayData();
ClearData();
}
else
{
MessageBox.Show(“Please Select user data to Update”);
}
}

 

 

IT Head Answered on December 20, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.