TableAdapter generate identity

  • Thread starter Thread starter Tempera
  • Start date Start date
T

Tempera

I add new row to DataTable (typed).
I called TableAdapter.Upadte method.
I noticed that field 'ItemId' (which is specified as Identity in SQL Server)
has a value of new added item.
This is great!

Is this feature documented?
Can i use it in production?

I also noticed when using Access, AutoNumber field as ItemId, this feature
does not work. (ItemId stays 0)
 
Tempera,

When you created your typed data set, the generator noticed that the
table in SQL Server has an identity column which is auto incremented.
Because of that, the DataColumn that represents the identity column has the
AutoIncrement, AutoIncrementSeed and AutoIncrementStep properties set so
that the TableAdapter will correctly update the column.

So yes, you can use it. This is the documentation you will want to
reference:

http://msdn2.microsoft.com/en-us/library/ks9f57t0(VS.80).aspx

As well as:

http://msdn2.microsoft.com/en-us/library/33y2221y(VS.80).aspx

I'm not sure why it doesn't work for access though. I try to avoid it
like the plague =)
 

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

Back
Top