Please, don't do it that way. That is an invitation to the accidental or deliberate destruction of your database.
Use Parametrised queries instead (and your problem will disapear as well).
cmd = new OleDbCommand("UPDATE userdata SET firstname=@FN, lastname=@LN, department=@DP, software=@SW, hardware=@HW WHERE sno=@SN", con);
cmd.Parameters.AddWithValue("@FN", TextBox2.Text);
cmd.Parameters.AddWithValue("@LN", TextBox7.Text);
cmd.Parameters.AddWithValue("@DP", TextBox3.Text);
cmd.Parameters.AddWithValue("@SW", TextBox4.Text);
cmd.Parameters.AddWithValue("@HW", TextBox5.Text);
cmd.Parameters.AddWithValue("@SN", x);
cmd.ExecuteNonQuery()
Oh, and BTW: don't use the default name for controls. You may remember that TextBox5 has the Hardware today, but in six weeks time? No chance. If you call it tbHardware instead, then it is obvious when you write it, and when you look back on it for maintenance.