• Post Reply Bookmark Topic Watch Topic
  • New Topic

Toofew parameters Expected when handling Insert statement

 
Haravallabhan J.N.
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!