R
Roy Thompson
Hi
I have a SQL table that has a field "Customer_Id". This is a bigint and it
is an Identity field with an auto increment of 1. The other fields are
Forename and Surname.
I wish to add a new record in Code so I use:
Dim rowNew As DataRow = dstCustomer.Tables(0).NewRow
rowNew("Forename") = Me.txtForename.Text
rowNew("Surname") = Me.txtSurname.Text
dstCustomer.Tables(0).Rows.Add(rowNew)
Dim cb As New SqlCommandBuilder(daCustomer)
daCustomer.Update(dstCustomer.GetChanges())
dstCustomer.AcceptChanges()
Which is all great. My question is how do I now get the Customer _ID field
for the newly added record? I wish to add this ID field to another table.
I have a SQL table that has a field "Customer_Id". This is a bigint and it
is an Identity field with an auto increment of 1. The other fields are
Forename and Surname.
I wish to add a new record in Code so I use:
Dim rowNew As DataRow = dstCustomer.Tables(0).NewRow
rowNew("Forename") = Me.txtForename.Text
rowNew("Surname") = Me.txtSurname.Text
dstCustomer.Tables(0).Rows.Add(rowNew)
Dim cb As New SqlCommandBuilder(daCustomer)
daCustomer.Update(dstCustomer.GetChanges())
dstCustomer.AcceptChanges()
Which is all great. My question is how do I now get the Customer _ID field
for the newly added record? I wish to add this ID field to another table.