Advertisement

04.04.2007 at 09:55AM PDT, ID: 22492326
[x]
Attachment Details

Insert Multiple Records into One Table

Asked by cuconsortium in Macromedia UltraDev, Macromedia Dreamweaver

Tags: insert, multiple, records, table, one

Dear Experts,

  I have 4 ASP pages.  I’m using Dreamweaver MX 2004 and SQL Server 2000.   The process needs to locate the Customer in the database first, then proceeds with creating order and order details.

1. locate.asp:  to search for Customer in the database
   Contains a text box to enter Customer ID and a Submit Button

2. Result.asp:
   Displays the customer record based on the Customer ID entered
   Provides a link to Order.asp page, this link passes the CustomerID to the Order.asp
   page

3. Order.asp
    Contains a text box for Order Date, a Multiline text field for Order Remarks, a hidden
    text box for CustomerID, and a Submit button.
    When the Submit button is clicked, it creates a new Order record in the Order table.
     Then, after clicking Submit button it takes you to the next page, OrderDetail.asp

4. OrderDetail.asp
    This page supposed to capture the OrderID that was created from the last page,
    Order.asp.
    Contains 11 check boxes labeled with different product names for each check box and
    a Submit button.
     The value of each check box would be the Product ID for each product.
    When the Submit button is clicked, the Order ID and the check box values needs to be inserted into OrderDetails table side by side as multiple records.

The Database structure is as followed:

Customer Table
----------------
CustomerID
LastName
FirstName

Order Table
------------------
OrderID
OrderDate
OrderRemarks
CustomerID

OrderDetails Table
-------------------
OrderDetailsID (auto increment number)
OrderID
ProductID

Product Table
----------------
ProductID
ProductName


Example:

Customer Table

CustomerID  LastName  FirstName
----------------------------------------
1                    John           Smith
2                    May            Lee
3.                   Peter          Williams

Order Table

OrderID   OrderDate   OrderRemarks           CustomerID
-----------------------------------------------------------
1               4-1-2007    Important Customer      2
2               4-2-2007    None                              1
3               4-3-2007    Urgent! Bluh..                2

OrderDetails  Table

 OrderDetailsID       OrderID         ProductID
----------------------------------------------------
1                               2                    3
2                               2                    5
3                               1                    4
4                               1                    2
5                               1                    3


Product Table

ProductID          ProductName
----------------------------------------
1                         Pen
2                         Box
3                         Shirt
4                         CD
5                         Paper
6                         board
 

My Question is:

On OrderDetail.asp page, How do I capture the OrderID that was created on Order.asp page?

On Order Detail.asp page, How do I insert the OrderID and ProductID into the OrderDetails Table side by side as Multiple records with one submit.

Any suggestion on change in design is welcome.  The only thing fixed is The user needs to first find the Customer with CustomerID, then proceeds with making orders.

Would a drop down list box be easier to work with than several check boxes?


Thank you!
Start Free Trial
[+][-]04.04.2007 at 10:10AM PDT, ID: 18852061

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Macromedia UltraDev, Macromedia Dreamweaver
Tags: insert, multiple, records, table, one
Sign Up Now!
Solution Provided By: DanielWilson
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.04.2007 at 10:16AM PDT, ID: 18852106

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.04.2007 at 10:43AM PDT, ID: 18852289

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2007 at 12:02PM PDT, ID: 19159236

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.25.2007 at 12:51PM PDT, ID: 19159567

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.15.2007 at 03:45PM PDT, ID: 19296048

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.20.2007 at 06:35PM PDT, ID: 19329860

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32