posted 20 years ago
Hello everyone,
The problem i'm having is a small one i hope.
I want to add an object to the database.
The database needs a primary key the object doesn't.
Too me this sounds like an autonumber in the db would be good, but i can't
program a suitable preparedstatement because the code i send is a column out eg.
PreparedStatement addDiary = connection.prepareStatement(
"INSERT INTO diary( name,date,time)
"VALUES ( ?, ?, ? )" ) ;
addDiary.setString( 1, z.getName());
addDiary.setString( 2, z.getDate());
addDiary.setString( 3, z.getTime());
addDiary.executeUpdate();
Send 3 attributes, but the db has 4: diarykey, name, date, time.
Any ideas?