Say that I have this code:
rentalEaseDataSet.tblCheckbookEntry.Rows.Add(newRow);
I want to get the identity of a column from that row I just added. How can I do this? Say the row is called ID.
For reference, I'm using C# and sql server express.
Say that I have this code:
rentalEaseDataSet.tblCheckbookEntry.Rows.Add(newRow);
I want to get the identity of a column from that row I just added. How can I do this? Say the row is called ID.
For reference, I'm using C# and sql server express.
Well, that row hasn't actually been saved to the database yet, so it doesn't have a database id (so sql server express isn't an issue). You need to use the adapter to save the changes, and then the id of newRow should reflect the database.
Assuming you are dealing with an auto-incremented identity value on the source of the data, you can't do this. You have to commit the changes to the data source through a data adapter, and then the column that represents the auto incremented id will be updated with the value.