HOW TO: Retrieve the Identity Value While Inserting Records into Access Database By Using Visual Basic .NET (815629)
The information in this article applies to:
- Microsoft ADO.NET (included with the .NET Framework) 1.0
- Microsoft ADO.NET (included with the .NET Framework 1.1)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual Basic .NET (2003)
For a Microsoft Visual C# .NET version of this
article, see
816112. IN THIS TASKSUMMARYThis step-by-step article discusses how to retrieve the
identity column value from an Access database. Retrieving the
Identity value from a Jet database is different from that of SQL Server,
because a Jet database does not support multi-statement batch commands. The Jet
OLE DB version 4.0 provider supports the SELECT @@Identity query that allows you to retrieve the value of the auto-increment
field that is generated on your connection. To run the SELECT @@Identity query, it is recommended that you use another OleDbCommand object. This article describes how to use a second OleDbCommand to retrieve the Identity column value. Note: This feature works only with Microsoft Jet OLEDB 4.0 databases.
The earlier versions of Microsoft Jet OLEDB do not support this
feature. back to the
topREFERENCES For additional information about a
related topic in Visual Basic 6.0, click the following article number to view
the article in the Microsoft Knowledge Base: 232144
INFO: Jet OLE DB Provider Version
4.0 Supports SELECT @@Identity
For more information, visit the following MSDN Web
site: back to the
top
Modification Type: | Major | Last Reviewed: | 9/4/2003 |
---|
Keywords: | kbJET kbProgramming kbTSQL kbSystemData kbHOWTOmaster KB815629 kbAudDeveloper |
---|
|