Menu

Cannot update Access table

Help
2016-12-14
2016-12-14
  • Denis MORIN

    Denis MORIN - 2016-12-14

    Hi all,

    I am using UCanAccess to update one of my table, the issue is on a field name that seems to be not recognized.
    Here is my code :

    String query = "UPDATE T_TACHES SET ETAT_TACHE = 'c' WHERE N° = ?";
          PreparedStatement pstmt = (PreparedStatement)connection.prepareStatement(query);
          pstmt.setInt(1, 1234);
          pstmt.executeUpdate();
          pstmt.close();
    

    This code does not work and give me a message "unknown token:"
    I tried with other fields and no issue, so the charater ° seems to be the cause.

    I also tried using \u00B0 but I have the same issue.

    Reading this field does not give any problem.

    Can you help me on this issue ?

    Thank you

     
  • Gord Thompson

    Gord Thompson - 2016-12-14

    I was able to reproduce your issue under v3.0.7, but I was also able to avoid it by putting square brackets around the column name: ... WHERE [N°] = ?.

     
  • Denis MORIN

    Denis MORIN - 2016-12-14

    Absolutely, it works you are correct. Thank you :-)

     

Log in to post a comment.