aspose file tools
The moose likes JDBC and Relational Databases and the fly likes How to Insert data into MS Access? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to Insert data into MS Access?" Watch "How to Insert data into MS Access?" New topic
Author

How to Insert data into MS Access?

ltanuwij
Greenhorn

Joined: May 29, 2001
Posts: 2
I have created a java swing code that is connected to the MS access 2000, I would like to know how to use the "Insert into" I can use the "SELECT"
What i did: INSERT INTO table_name (field_name) VALUES (the value)
and i always get this error message;
java.sql.SQL.EXCEPTION:[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1

In my table there is only one field which is called "Name"
Thank you
ltanuwij
Greenhorn

Joined: May 29, 2001
Posts: 2
Don't worry i solved it
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"Itanuwij",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Amit Barot
Greenhorn

Joined: May 29, 2001
Posts: 13
Yes u can insert into the MS ACCESSS 2000
pass the string into the
statement.executeQuery("insert into <table Name>(<field1,field2) values('String','String',Integer)>
look the followwing thing is a new thing which i found out
if u hav some value assinged to a variable like
String name = "amit";
and if u want to insert that variable then the syntax in the VALUES will be values('"+name+'",'"+name2+"')otherwise u will get an SQLException java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
ok then this might solve your query
bye.
 
 
subject: How to Insert data into MS Access?