2008年7月15日 星期二

[JDBC]取得Insert入DB table後其auto increment欄位值

获得auto increment column 值的方法

1 則留言:

  1. 後記:
    在使用時記得
    con.PreparedStatement(sql,PreparedStatement.RETURN_GENERATED_KEYS);
    以及
    statementObj.executeUpdate(sql,Statement.RETURN_GENERATED_KEYS);
    中第二個參數,否則會出現SQLServerException: The statement must be run before the generated keys are available

    回覆刪除