This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
What's wrong with my statement? String prdID = "a111"; String sql = "Select * " + "from Prd_Cat " + "where PID = " + prdID; rs = stmt.executeQuery(sql); My database connection is no problem, I can execute other sql statements. However, when I executed the above statment , an error message is generated: --------------------- java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2494) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:334) at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:249) at ProductDesptServlet.doGet(ProductDesptServlet.java:68) .............................. What does the error message mean?
Some time we might have missed space between "select *" and "from Prd_Cat" since these two are typed in diff lines. So just print the query in the out.println(sql). This will print the query in either in the page or in the html. Copy the query and paste the same in the SQL * Plus. There it will exactly point out the place where you did the mistake. I could not able to answer this question because I did not have any infornation about your table. Hope this helps [ March 05, 2002: Message edited by: Balaji C ]