Execute Update from Java to Access database problem...

L

lalalala

public boolean addItem(String barcode, String style, String colour,
String size, String qty, String store){
boolean complete = false;
String addItem = "INSERT INTO items (barcode, style, colour, size,
qty, store) VALUES
('"+barcode+"','"+style+"','"+colour+"','"+size+"','"+qty+"','"+store+"')";
Statement stmnt = null;
System.out.println(addItem);
try {
stmnt = conn01.createStatement();
stmnt.executeUpdate(addItem);
//stmnt.execute(addItem);
complete = true;
} catch (SQLException e) {
e.printStackTrace();
}

return complete;
}

-----The statement works but the executeUpdate isnt updating the
database, when i use the same query directly in access it works and the
connection works for other queries, that modify the information of an
already existant row of information, but for this im not getting any
errors its just not updating my database.
Any ideas on what it could be?
Any help would be greatly appreciated.
Thank you, and ignore last message i fixed that problem
 
L

lalalala

Well for previous update statements it wasnt required (SQL commit), and
they updated succesfully. Although perhaps it is because in this case
i'm trying to insert a new row in the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top