Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP 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 January 2nd, 2008, 11:12 AM
Registered User
Join Date: Nov 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inserting Data into Multiple Tables

I have two tables Orders and Orders_detail.
The Orders table has OrderID as the primary key.
The Orders_detail table has the OrderID as a foreign key.
In my ASP application, I want to insert a record into both tables. How do I get the OrderID from the Orders table, so that I can insert the data into my Orders_detail table. In Oracle, I would have the OrderID set as a sequence and then use the OrderId.currval for the insert into the Orders_detail table. I'm not sure how to do this in Sql Server 2005. Can anyone help ?

Old January 3rd, 2008, 12:28 AM
Friend of Wrox
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi

Follow the link you will get your solution.

You will also need to study how to access sql stored procedure from asp code, because you want get order id back and pass it to detail table.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting data in multiple tables rohits PHP How-To 1 August 29th, 2006 11:32 PM
Inserting a record and contents in multiple tables Shell84 ASP.NET 2.0 Professional 6 August 15th, 2006 05:31 PM
data from multiple tables keyvanjan Classic ASP Basics 1 January 24th, 2006 06:32 PM
Inserting data into 2 tables chrscote Access ASP 1 August 1st, 2005 09:01 AM
inserting into multiple tables cridley SQL Server 2000 1 January 25th, 2005 12:05 PM

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