[Sample Of Mar 24th] How to retrieve the Identity value after inserting a data using ADO.NET


Homepage image
RSS Feed

Sample Download : http://code.msdn.microsoft.com/How-to-Retrieve-the-511acece

We often set a column as identity column when the values in the column must be unique. And sometimes we need the identity values of new data. In this application, we will demonstrate how to retrieve the identity values:

1. Create a stored procedure to insert data and return identity values;

2. Execute a command to insert the new data and display the result;

3. Use SqlDataAdapter to insert new data and display the result. 

imageYou can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.