Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

[ODBC Microsoft Access Driver] Too few parameters. Expected 21.

Posted on 2003-02-24
7
Medium Priority
?
765 Views
Last Modified: 2010-08-05
I am trying to populate an Access database using insert statements through JDBC. All the fields in the table are defined as text. If I try the statement below, I get the Too few parameters.... error.
temp: insert into bill_payment_data values(eric1,eric2,eric3,eric4,eric5,eric6,e
ric7,eric8,eric9,eric10,eric11,eric12,eric13,eric14,eric15,eric16,eric17,eric18,
eric19,eric20,eric21)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 21.

However if i just try to insert 1,2,3,..21, the insert works fine. Any idea what the problem is?
0
Comment
Question by:GreatOne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 58
ID: 8011916
Your not supplying enough arguments and/or in the correct format.  It's looking for 21 of them.

  Make sure that "eric1" etc can be resolved to a value.  If that is the value, then you should be putting it in quotes.

Jim.
0
 
LVL 2

Expert Comment

by:NArentz
ID: 8012316
Hi,

The syntax is not quite correct. Access needs the following syntax:

INSERT INTO bill_payment_data (list of field names in order matching values list ) VALUES (eric1, eric2, eric3, eric4, eric5, eric6, eric7, eric8, eric9, eric10, eric11, eric12, eric13, eric14, eric15, eric16, eric17, eric18, eric19, eric20, eric21)

You can also use this syntax: INSERT INTO tablename SELECT field names FROM tablename

Hope this helps.

0
 

Author Comment

by:GreatOne
ID: 8016894
I am now using the correct syntax. However, I now get this ODBC error:
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria express
ion.

All of the fields are text fields. Do the eric1,eric2..have to be in quotation marks?
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 300 total points
ID: 8016986
<<All of the fields are text fields. Do the eric1,eric2..have to be in quotation marks?>>

  If they are the actual values and text, then yes.

Jim.
0
 

Author Comment

by:GreatOne
ID: 8018526
I put the values in quotation marks but am still getting that Data type mismatch.
0
 
LVL 2

Accepted Solution

by:
NArentz earned 300 total points
ID: 8020495
Hi again,

You need to check each field in the table against each value you are trying to insert. You may have the order slightly out. The order needs to be exactly the same. Also if the values are actually variables check that you are supplying values. Don't forget to check the table to see what sort of data it will allow. By this I mean if the field will allow nulls or empty strings and how long the field is.

Supposing the values are not variables and are all text the syntax would look like this:
INSERT INTO bill_payment_data (list of field names in order matching values list ) VALUES ("eric1", "eric2", "eric3", "eric4", "eric5", "eric6", "eric7", "eric8", "eric9", "eric10", "eric11", "eric12", "eric13", "eric14", "eric15", "eric16", "eric17", "eric18", "eric19", "eric20", "eric21").
Dates need to be enclosed in hashes eg #01/01/2003# and numbers don't need anything.

Cheers,

Nicole
0
 
LVL 18

Expert Comment

by:1William
ID: 8734551
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, split points to JDettman and NArentz
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
1William
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question