JDBC INSERT with autonumbers
Posted on 2003-11-24
Here's the problem query:
int update = statement1.executeUpdate(
"INSERT INTO diary(name,date,time,)
VALUES ( "
+ z.getName() + "','" + z.getDate() + "','" + z.geTime()")");
The problem is, in the database table diary preceeding 'name' there is an autonumber acting as the 'primary key', called diarykey.
What's the best way to include this in the query, because when i leave it out i get 'INSERT SYNTAX ERRORS'!