assign connection object to cmd
cmd.Connection = con;
see below code
cmd.CommandText = "insert into emp values (@empno,@ename,@job,@sal,@hiredate,@comm,@deptno) ";
cmd.Parameters.AddWithValue("@empno", TextBox1.Text);
cmd.Parameters.AddWithValue("@ename", TextBox2.Text);
cmd.Parameters.AddWithValue("@job", TextBox3.Text);
cmd.Parameters.AddWithValue("@salary", TextBox4.Text);
cmd.Parameters.AddWithValue("@hiredate", TextBox5.Text);
cmd.Parameters.AddWithValue("@comm", TextBox6.Text);
cmd.Parameters.AddWithValue("@dept", TextBox7.Text);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Also use same parameter in query and in command parameter
cmd.Parameters.AddWithValue("@sal", TextBox4.Text);
Hope this will help you