Dear friends , I have written a Java class to insert 01 record into a table in an Access database. But when I ran my compiled class it threw an error. I send the .java file as well as the .mdb file to you. Please correct the problem. Thank you!
[Edited to disable smilies and add UBB code tags. To do this yourself next time, smilies can be disabled at the bottom of the edit screen and the code tags are right below the editing textbox.] [ September 23, 2004: Message edited by: Jeanne Boyarsky ]
It is a good practice to give the error. With that error as the base, there won't be a necessity for code to fix the error. Without knowing the error, It would be very difficult for anyone to go thru the code, compile it and find the error.
What if they don't a database, that you are using? So, if u can plz specify the error that you encounter, prolly someone can look ito that.
Joined: Sep 23, 2004
The error was too few arguements, expected: 4
Joined: Aug 15, 2004
do e.printStackTrace() and then paste it here. it might help us.
String query = "Insert book Values(bc, bc, ba, baq)";
should pass the variable's values, not it's names. Thus, the parameters expected message.
Try something like
String query = "Insert book Values('" + bc + "', '" + bn + "', '" + ba + "', " + baq + ")"; System.out.println(query); // this should looks like your commented line below //String query = "Insert into book Values ('AAA','BBB','CCC',1)";