Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Too few parameters. Expected 3

 
Kumanan Guna
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I m trying to run select query with "group by" to get the customer information (using MS Access DB), but getting "Too few parameters. Expected 3" exception.

Noticed when I run select query along with subquery to pull last 24 hrs of sum of records I m getting this exception, without subquery getting expected output.
Joining 3 tables to get list of all records. Please let me know, is there a way I can run below mentioned query along with subquery or do I need to split into 2 parts.
One without subquery and otherone running subquery as seprate.



Exception:


Please advice.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that is the code? As written, it looks like it shouldn't work at all.

Here's what I see happening:
  • create a Statement object without SQL (which implies the query would be passed later - except that this object is never used)
  • set parameters on the PreparedStatement - which is null - this would throw a NullPointer
  •  
    Wei Dai
    Ranch Hand
    Posts: 86
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    >CS.OUT_TIME between ? and ? and ...
    Try (CS.OUT_TIME between ? and ?) and ... May your sql syntax is too complicated to be understood by MS Access.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic