开发者

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters

开发者 https://www.devze.com 2022-12-21 21:46 出处:网络
It seems that this part of my code is where the exception occurs: c = dbConnection.getConnection(); q = \"SELECT * FROM book WHERE nextInc<=? AND inlib=?\";

It seems that this part of my code is where the exception occurs:

c = dbConnection.getConnection(); 
q = "SELECT * FROM book WHERE nextInc<=? AND inlib=?";
s = c.prepareStatement(q); 
s.setBigDecimal(1,BigDecimal.valueOf(curDate.getTime())); 
s.setBoolean(2,false); 
rs = s.executeQuery(); <-- Error.
开发者_如何转开发

I'm using "sun.jdbc.odbc.JdbcOdbcDriver".


As per this, the error could occur because of non-existent column.

Could you put the structure of the table here?


After checking all of my column names, I also discovered that double quotes around a string literal will cause the same error.

Wrong: WHERE foo LIKE "bar"

Right: WHERE foo LIKE 'bar'

Just an FYI for any non-Access folks scratching their heads (like me).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号