c++ – CRecordset – get auto-generated ID after Update() – Education Career Blog

Having just called Update() on an MFC CRecordset (ODBC/Dynaset) what can I do to pull the auto-generated ID without hitting the database again? Ideally whatever it is would work in both SQL Server and MS Access (so querying for the last identity might not work…)

,

Can’t be done. It’s necessary to hit the database a second time to pull the @@Identity. Bummer.

Leave a Comment