Hey There, I've put an auto increment into my database for updating some of my tables. When using preparedStatements I know that you dont put in a question mark in the insert statement, but what does one put in there? This is the code and assume that the auto incfrement is the first field in the table. String query = "INSERT INTO SUPERLOG VALUES (?,?,?,?,?,?,?)"; And when doing the - Stmt.setString(1,""); -stuff do you leave one blank? Or do you leave it out altogether? Here is the code...
Raymond, If you want us to properly help you, then you need to supply some more information.
Can't get the bloody thing to run.
Then posting the entire error message and stack trace you are getting would aid us greatly in our quest to help you overcome your problem. It appears that you are using an Oracle database, and that you have defined an Oracle "sequence" object -- namely NEXTSUPERLOG, so yes, in order to get the next (sequence) value, you need to use:
However, it appears that you are not taking into consideration the data types of the columns in your SUPERLOG table. From what I can gather from your posts, it would appear that this table has the following columns:
I would assume that columns "ID","day","month" and "year" are NUMBER columns. If that is so, then treating them as strings may cause problems (but since I couldn't find any details of your exact problem, I'm only guessing). So I suggest you try the following code: [Note: Incomplete, not compiled and untested!]