This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a problem. I'm in the process of creating a online system where people login and stuff. I've got the login page working correctly and the database connection working correctly also. I have given users the option to register if they have not been on before, and this is where I come unstuck. The user enters in their details (into a jsp page this is), and clicks the register button and it attempts to enter the new record into the database. Every field they have to enter is either a text field or a drop down box. Their date of birth is entered via 3 drop down boxes. One for day, one for month and one for year. Once the register button is clicked, it uses a servlet to check the database and enter the record.
That is some of the code from the servlet. The error that I get is below.
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '''October 27 1988'''.
I think this is an SQL error, to do with the way the user enters the date but i'm not sure. Can anyone help me?
Bron [ September 17, 2004: Message edited by: Bear Bibeault ]
Alternatively use a PreparedStatement and bind the date parameter as a java.sql.Date object rather than a String. Much safer, and means you can swap the database (or change the date format - if you were using a better database than Access) without having to change your SimpleDateFormat.