Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 26th, 2007, 09:32 PM
Registered User
 
Join Date: Sep 2007
Location: Philadelphia, PA, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADD DB RECORD/ RETURN ID

Hi Everyone.

So I'm totally new to ASP, but I've done some VBS simple vbs coding and therefore I'm semi comfortable with asp. I'm currently working on a shopping cart and I'm pretty much done with the basic functionality (ie. adding products to cart, calculating coupons, removing products and updating quantities.) Pretty much what I'm currently stuck on is saving the order to an access DB and getting back the order ID, (primary key) for the new record created. How is this done?

Thanks for all the support.

Reply With Quote
  #2 (permalink)  
Old October 1st, 2007, 11:55 PM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Assuming you are using an Autonumber field for your primary key, one easy way to do this is to use an ADODB.Recordset to add the new record instead of an insert statement. You must open a recordset (an empty recordset will do) with all the fields that are required. Add a new record and set all the required fields, and Update it. The Id field will contain the new ID.

Cheers,

Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to return the ID through a dataset? chobo2 C# 2008 aka C# 3.0 10 June 25th, 2008 07:56 PM
Add New Record in Access DB sidra Classic ASP Databases 1 June 2nd, 2008 01:13 PM
ASP Add New Record and Get ID omninewt Classic ASP Databases 5 April 10th, 2008 12:20 PM
DTS return table ID forkhead SQL Server DTS 2 November 9th, 2006 12:15 PM
ASP program How to add new ID for new record kinshuk SQL Server ASP 3 March 21st, 2005 02:43 PM



All times are GMT -4. The time now is 05:13 PM.


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