UpdatedRowSource and @@SelectIdentity

Hi,

This is my first posting here, so please be patient with me :-) I have an application that uses strongly typed datasets with an Access DB. The Access DB table that I'm referring to here has an ID that auto-numbers when a new row is inserted.

The question I have is: My oleDBDataAdapter.InsertCommand's UpdatedRowSource property is set to 'BOTH'. Which to my understanding means that the new row that was created should be mapped back to my DataSet and parameters (although all of my parameters are input-only). However, when I go to look at my DataSet in my oleDBdataAdapter_RowUpdated() subroutine, I don't see the ID of the newly created row. Instead, to make things work, I have to use @@SelectIdentity to retrieve the new ID, and update the DataSet myself.

So, the question is why can't I simply see the Auto-Numbered ID on a new row insert automatically in my DataSet I see all of the other data members populated. Perhaps my understanding of the UpdatedRowSource is faulty.

Any answers/feedback would be much appreciated!

Miss Peach



Answer this question

UpdatedRowSource and @@SelectIdentity

  • Neha Katoch

    The UpdatedRowSource property indicates to the DbDataAdapter to look for output parameters and or the first row of the first returned result and map those results back to the DataRow.

    Your InsertCommand needs to insert & bring back the 'select @@SelectIdentity as MyIdColumnName'.



  • UpdatedRowSource and @@SelectIdentity