Retrieving Newly Generated Auto-Increment Values

SQL Server, Access, Sybase, MySQL, and other databases use auto-increment columns, also referred to as identity columns. (Oracle offers similar scenarios through its sequences.) You can insert a new row into a table, and the database will generate a new value for the auto-increment column for that row. Many tables in the Northwind database—such as Employees, Orders, and Products—use auto-increment columns for their primary keys.

How does working with auto-increment columns differ from general scenarios that require refreshing the conents of the row after performing an update? In the previous examples, the query executed to refresh the contents of the row used the value of the primary key columns ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.