I'm trying to update a table (my Customer table). One of the columns in this
table is the ID (Customer Id number). It's the key, and it is an
autonumber--Access automatically increments it to the next available integer for
each new record. How do I specify this in Java JDBC code? I've tried just not
including the field in the SQL update statement but I got an exception:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver] Number of
query values and destination fields aren't the same.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:3669)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:3822)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:1063)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:214)
at
sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:171)
at CustomerInsert.insert(CustomerInsert.java:63)
Would a good approach be to query for the biggest CustID# first and then
increment it, or is there an eaiser way?
Also, I'm a little green on DB design and programming. What's a good way to
ensure Customer's don't get inserted more than once?
--
Darrel Riekhof
FerretTronics--Servo Control Chips and Software
http://www.busprod.com/ferrettronics/