Auto Increment primary key issue
Posted on 2006-06-28
I have a sql server database, and for a primary key I use an auto incrementing integer field. In my code I create a new row like this...
Dim rowNewRow As DataRow
rowNewRow = Me.DsTheDataSet.TheTable.NewRow
rowNewRow.Item("Field1") = "something"
That works fine, but the primary key created for the new row isn't the real key, it's just an auto increment starting from 1. Once the data is save the primary key updates to the real one. The thing is I want to be able to use the primary key value before saving the dataset. Is this possible?
Thanks a lot