User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 425,896 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,907 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1550 | Replies: 16
Reply
Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

creating order/order detail insert forms

  #1  
Jun 4th, 2008
Hi guys!

I have an order table and an order detail table in a database. I am trying to create insert forms using ASP for these so the user can insert new order details. I created an order details table to solve the many to many relationship between the order table and the product table. I am not sure how to do this... any ideas??

What i have so far are two ASP pages one with an insert form for the order table and one for the insert form for the order detail table. Once the user enters details of the order in the first form they are transfered to the page for the order details table, in this form they fill out the product details for the order. I need to be able to link these forms together somehow. I thought that the order details table and form would hold the order ID from the first insert form but i cannot get the ID to pass. I have tried using master detail page set but this doesnt work in this situation.

I would have thought that creating insert pages for order and order details tables would be quite common.. i cant find anything!

Any ideas would be great!

I am a student on placement with not long left and i need to finish my application ASAP. I have asked a few other questions on this forum that nobody seems to know the answer to. PLEASE HELP!

Thanks!
GLT
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

Re: creating order/order detail insert forms

  #2  
Jun 4th, 2008
would use a stored procedure to join and insert the ID into the details table??

any ideas??
Reply With Quote  
Join Date: Aug 2007
Posts: 76
Reputation: anto_nee is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
anto_nee anto_nee is offline Offline
Junior Poster in Training

Re: creating order/order detail insert forms

  #3  
Jun 7th, 2008
Try to go to the next page for the order details to enter, with the order main details as hidden fields.. then use two different queries to insert both the tables..
Procedures possible when u have the master table values GLT..
Reply With Quote  
Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

Re: creating order/order detail insert forms

  #4  
Jun 11th, 2008
how would i do this? I thought only one insert was allowed per page??
Reply With Quote  
Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

Re: creating order/order detail insert forms

  #5  
Jun 11th, 2008
if i did use the method you suggested it would not solve the ID problem which was the original problem. I need to add the ID of the order that has just been entered into the orderline table as a foreign key. This is the original problem how can i do this??

Thanks
Reply With Quote  
Join Date: Aug 2007
Posts: 76
Reputation: anto_nee is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
anto_nee anto_nee is offline Offline
Junior Poster in Training

Re: creating order/order detail insert forms

  #6  
Jun 11th, 2008
once u come into the order details From the master order page, u will have the ID right.. insert both at same time.. means write the queries according to the situation..
Reply With Quote  
Join Date: Jun 2008
Location: Delhi
Posts: 119
Reputation: vicky_rawat is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 15
vicky_rawat's Avatar
vicky_rawat vicky_rawat is offline Offline
Junior Poster

Re: creating order/order detail insert forms

  #7  
Jun 13th, 2008
I cann't understand why you cann't pass id.
Simply get the last inserted id and pass it to next page.
Reply With Quote  
Join Date: Jun 2008
Location: Delhi
Posts: 119
Reputation: vicky_rawat is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 15
vicky_rawat's Avatar
vicky_rawat vicky_rawat is offline Offline
Junior Poster

Re: creating order/order detail insert forms

  #8  
Jun 13th, 2008
In the order page (1st one), add record in to order table and get the order_id
using the following syntex
str = "set nocount on "
str = str & "insert statement "
str = str & " select sn=@@identity set nocount off"
set rssno = oConn.execute(str)
sn = rssno("sn")

pass this value as hidden variable in next page and then you can use this to populate the foreign key in order details table.
Reply With Quote  
Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

Re: creating order/order detail insert forms

  #9  
Jun 23rd, 2008
Originally Posted by vicky_rawat View Post
I cann't understand why you cann't pass id.
Simply get the last inserted id and pass it to next page.

I cant do it because ive never done it before... have to start somewhere somehow.
Thanks for your help! ill try that now.
Reply With Quote  
Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

Re: creating order/order detail insert forms

  #10  
Jun 23rd, 2008
Hi!

I cant seem to get it to work. I am a newbi to this sort of thing so im not sure exactly where to put this code or how to edit it (if at all) for my page.

Can someone please help me and tell me what i should do. I cant find any tutorials or anything on this so I cant learn any other way.

Thanks
GLT
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP Forum

All times are GMT -4. The time now is 7:32 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC