Q:

passing data parameters to updata SQL table

A user enters in his information via 8 JTextFields. This information is passed via parameters into the updateUser method and the method updates the SQL table with this information. This is what I am currently trying to do although when User presses update button, no changes are made to the database table
retrieve user data, create UserOperation and call updateUser method 
   String userName = textFieldUserName.getText();
                String userPassword = textField_1.getText();
                String securityQuestion = textFieldSecQuestion.getText();
                String securityAnswer = textFieldAnswer.getText();
                String email = textFieldEmail.getText();
                String fName = textFieldName.getText();
                String phoneNumber = textFieldPhone.getText();
                String department = textFieldDepartment.getText();

                UserOperations userOperations = new UserOperations();
                userOperations.updateUser(userName, userPassword, securityQuestion, securityAnswer, email, fName, phoneNumber, department);

the updateUser method
     public void updateUser (String userName, String userPassword, String securityQuestion, String securityAnswer, String email, String fName, String phoneNumber, String department)
    {

        try
        {
            String sql = "UPDATE systeuser SET username = ?,userpassword = ?,securityquestion = ?,securityanswer = ?,email = ?,fname = ?,phonenumber = ?,department = ? WHERE username = ?";
              stmt = conn.prepareStatement(sql);
              stmt.setString (1, userName);
              stmt.setString (2, userPassword);
              stmt.setString (3, securityQuestion);
              stmt.setString (4, securityAnswer);
              stmt.setString (5, email);
              stmt.setString (6, fName);
              stmt.setString (7, phoneNumber);
              stmt.setString (8, department);
              stmt.setString (9, userName);
              stmt.executeUpdate( );
        }
        catch (Exception e)
        {
            e.printStackTrace ( );

        }

    }

A:

Its because of the single quotes placed around the ?. You need not give those single quotes, since you're doing this:-
stmt.setString(1, userName); // setString says that this parameter is a String

Thus, the single quote generally used to enclose String in a query is not needed in your case.

