Gil
Gil

Reputation: 33

SCOPE_IDENTITY() after TableAdapter Update, using BindingSource

Trying to get the Autoincrement ID of a row after TableAdapter.Update. The data is Binded so there's no row being added to the datatable as in this case.

Any ideas on how to solve this?

Thank you

Upvotes: 0

Views: 1588

Answers (2)

Nocturnal
Nocturnal

Reputation: 386

Why not use this after TableAdapter.Update:

CType(xBindingSource.Current, DataRowView).Item("ID")

Upvotes: 1

peterG
peterG

Reputation: 1641

You need to retrieve the newly created id by including a select statement in your insert query; you need to change the executemode to Scalar, too. This blog post has more detail

Upvotes: 0

Related Questions