Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2005, 03:39 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default get recordet id after insert

Hi,
How can I get the recordset ID after inserting it with sql command in ms access db?
thanks

 
Old May 9th, 2005, 11:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can use @@Identity to get the identity of the row just inserted.

 
Old May 10th, 2005, 01:48 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

The previous post is tad misleading
@@Identity is in MS-sqlserver

You can go for select max(Id) from yourTable
Immideatly after inserting , also put the both in a transction.

This will work in any back end DBMS

Prashant
 
Old May 13th, 2005, 12:56 AM
Authorized User
 
Join Date: Aug 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

@@identity works well in Access(2000), no idea of earlier versions.

regards,

Vinay

 
Old May 13th, 2005, 06:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Keyvanjan,

Did that solve the problem?

_________________________
- Vijay G
Strive for Perfection
 
Old May 14th, 2005, 05:15 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes,thanks.@@identity helped






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the LAN ID and insert into database ? kutel ASP.NET 2.0 Professional 1 August 15th, 2007 03:51 AM
How To insert auto increment ID to other table ibrhaim ASP.NET 1.0 and 1.1 Professional 4 December 8th, 2006 02:26 PM
How to insert 2 tables with same auto increment ID ibrhaim ASP.NET 1.0 and 1.1 Basics 1 December 7th, 2006 05:00 PM
ASP Insert - Get Record ID llowe Classic ASP Databases 2 March 24th, 2004 11:11 AM
Insert new record ID levinho Classic ASP Databases 5 January 14th, 2004 12:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.