"Refresh the data table" tableadapter option


G

Guest

Hi all

I'm a bit confused by the "Refresh the data table" option under Advanced
Settings when configuring a tableadapter. When I look at the InsertCommand I
can see that it has added a SELECT statement after the INSERT statement, but
I don't know how to access the returned values. E.g. I have "user" table
(which has an identity PK), I might insert rows like this:-

userTableAdapter.Insert("Jo Bloggs", "(e-mail address removed)", etc...);

The Insert method returns an int (number of rows affected), so how do I get
at the refreshed row values (particularly the identity PK assigned to the new
row)? I have seen other articles suggesting "roll your own" Insert query that
returns the ID as a scalar, but it would be nice to use the built-in "refresh
the data table" option, if this is what it's intended for.

Thanks in advance

Andy
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top