#Can't insert values into Access Database
17 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @deep sigil! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
you aren't specifying id_client'?
i guess that's AutoNumber? in which case i'm not sure how you can ask access to autogenerate an id from JDBC
maybe try giving 0 or something
oh it looks like a foreign key constraint actually, i guess a contact belongs to a client
in that case you need to specify the client this contact is for?
Sorry if I'm rusty, I just started learning databases using ucanaccess, what do I need to do to specify it ? normally I'd just input the table name give values to each table column
String sql = "INSERT INTO Contacts (Client_Name, Client_LastName) VALUES " + "('Test', 'TestTest')";
so u can see ID_Client is a primary key
the rest are regular
I don't think It's going to work if I just specified ID_Client nad VALUES ('0') to it, I've tried it and I got a different error.
or do I just change the data type for the primary key to auto since In my opition if I haven't specified it, would just give a auto number ?