Watch out for sql-injections. Heres an example of your code using
SqlParamter
s
con.Open();
str = "update tb set ename=@ename, expe=@expe, eplace=@eplace where eno=@eno";
cmd = new SqlCommand(str, con);
cmd.Parameters.AddWithValue("@ename", textBox5.Text);
cmd.Parameters.AddWithValue("@expe", textBox6.Text);
cmd.Parameters.AddWithValue("@eplace", textBox7.Text);
cmd.Parameters.AddWithValue("@eno", textBox1.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("Successfully updated");
con.Close();
Easier to read and safer to execute!
Run your debugger to see if your textbox values are as expected. And run sql profiler to what your sql-command is when it is sent to your database server.
Pankaj Chamria has written an excellent article about how to debug using Visual Studio:
Advanced Debugging in Visual Studio[
^]