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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.