I am trying to make a select query based on a user input. Earlier I was having probelms making a select query and printing out the result in the stack trace,with the advice given here, I managed to solve that. I am now modifying that code to make a query based on user input, however it's not working, following is the code:
stack trace seems to suggest I may have a probelm with this statement:
I am not sure how to rectify this, I hope someone can advise, thanks.
Joined: Jan 30, 2006
You're preparing the SQL statement, then setting the first parameter, but that is not what you're executing on the executeQuery. Have a look at the java.sql API.
You're actually calling the inherited method java.sql.Statement.executeQuery(String) with an incompleted SQL string when you probably want to call java.sql.PreparedStatement.executeQuery() given that you went through the trouble of preparing it and setting the parm.
Hope this helps.
Joined: Dec 23, 2008
Hi Ed Ward...
Thanks for the message, I appreciate it. I have managed to solve the problem based on your advise and also from this site. I only made one change...