Eric - 2006-11-09

The built in code to generate an IDENTITY result.
Keeps returning a null.  If I use the SQL Query Analyzer, and run the query and then the Identity query manually everything works ok.

The INSERT query before the IDENTITY query is :
INSERT into help_resolution (user_id,resolution) values (12,'this is a test');

The table includes an auto increment field called "ID".

Anyone have similiar issues?

- Eric

if (!pObject.isIdModified())
                {
                    PreparedStatement ps2 = null;
                    ResultSet rs = null;
                    try {
                        ps2 = c.prepareStatement("SELECT @@IDENTITY");
                        rs = ps2.executeQuery();
                        if(rs.next()) {
                            pObject.setId(Manager.getInteger(rs, 1));
                        } else {
                            getManager().log("ATTENTION: Could not retrieve generated key!");
                        }
                    } finally {
                        getManager().close(ps2, rs);
                    }
                }