Simply because the value of gender is never set:
private void button1_Click(object sender, EventArgs e)
{
Staff s = new Staff();
staffAG j = new staffAG();
j.id = comboBox2.SelectedIndex;
j.name = textBox2.Text;
j.age = textBox3.Text;
j.phone = textBox4.Text;
j.address = textBox5.Text;
j.post = comboBox1.Text;
s.updatestaff(j);
MessageBox.Show("Record updated");
}
You set the other properties of the staffAG instance, but since you don't set gender, it remains null.
Null passed as a parameter to a column that can't be null, will throw an exception.
BTW: The standards for naming in C# is for an initial uppercase character for properties - it's a good idea to stick with such standards.