File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Toofew parameters Expected when handling Insert  statement Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Toofew parameters Expected when handling Insert  statement" Watch "Toofew parameters Expected when handling Insert  statement" New topic
Author

Toofew parameters Expected when handling Insert statement

Haravallabhan J.N.
Greenhorn

Joined: Jan 27, 2003
Posts: 2
I am trying to insert around 25 values in to my MS Access DB with an Insert statement through many iterations. The values get inserted for some iteration and it doesn't insert for few. It gives an error message -'too few parameters expected'.
I am not able to trace the flaw in my code.Can any of you guess the reason for this.
Thanks
Hara
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
One possible reason might be because of usage of single quotes and double quotes.
Posting the relevant code can reduce the guess work and bring in more clues.
Haravallabhan J.N.
Greenhorn

Joined: Jan 27, 2003
Posts: 2
Hi Mani
Atlast I found the flaw. I had a column in my table with data type 'Number' in MS Access. I overlooked it and I kept on inserting string values and interger values in random. The integer values got inserted and when the string values get in the error was thrown. But I wonder why it throws an exception -'too few parameters expected' instead of throwing 'data type mismatch criteria' exception.Can any one tell me the reason?..
-------The error I made ----------
( The code I used was
insert into DETAILS values("+sNo+",.....
here the column where the value sNo inserted is in Number data type.I kept on inserting the values like
1,a,b,2,3,...
Ima not assigning any values to the variable rather I get the values from a form and inserting them.)
 
 
subject: Toofew parameters Expected when handling Insert statement
 
Threads others viewed
help with a exception
string variables
INSERT Issue
How to Insert data into MS Access?
insert to database...
Two Laptop Bag