The values are not transported into your sql command actually. The instance of class contract which you create in the class 'sqlDbOperations' is different from the one you create in btnInsert_Click. And you need to transport the one created in btnInsert_Click to sqlDbOp.insertContract();
to insert into DB.
So you can do something like this:
public void insertContract(contract con)
{
//Open
openConnection();
//Command
SqlCommand myCommand = new SqlCommand("INSERT INTO tblContracts (EmployeeId, Duration) VALUES (@employeeId, @contractDuration)", myConnection);
//Get values from form
formConnection formInput = new formConnection();
//Add parameters
myCommand.Parameters.AddWithValue("@employeeId", con.employeeId);
myCommand.Parameters.AddWithValue("@contractDuration", con.duration);
//Execute
myCommand.ExecuteNonQuery();
//Close
closeConnection();
}
And for the exception 'The input string format is not correct'. Maybe you can refer to this link