Retrieve an Identity Value After Using ExecuteNonQuery To Execute INSERT Statement RRS feed

  • Question

  • Does ADO.NET provide a way to retrieve an identity value (simlar to running "SELECT @@IDENTITY" or "SCOPE_IDENTITY()") without actually running those commands after using the ExecuteNonQuery() method to execute a simple INSERT statement?


    Friday, July 31, 2009 6:57 PM


  • There is nothing automatic, no. You still have to write the underlying queries, whether you pass them to the database or use a stored procedure.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by dgolds Friday, July 31, 2009 9:29 PM
    Friday, July 31, 2009 8:05 PM