Managing Shipping
Introduction. Now
we need to create an interface to display and modify shipping rates. We need both a form for display and modification,
ManageShipping.asp. The processing scripts for adding, deleting
and updating will be in the next page. The ManageShipping.asp has a stored procedure to
retrieve the current shipping information from the Shipping table for
display in the form.
The following table gives the ASP and stored procedure we will develop in this page. |
Stored Procedure | ASP Container |
sp_GetShippingRate | ManageShipping.asp |
The Stored Procedure.
First we present the stored procedure. Remember, you do not need
to implement the stored procedures, this is to illustrate what you would
need to do if you had the correct permissions in your database.
The first stored procedure uses a SELECT command in SQL to obtain all of the information from the Shipping table. The stored procedure sp_GetShippingRate was previously developed when we computed the shipping and tax during the checkout process in the store. The ManageShipping.asp. This is essentially a form page to display and allow modification of shipping rates. There are links to processing scripts that allow the addition of rates, updating rates and their deletion. You need to save this file and upload it to your StoreManager subdirectory.
Call the file ManageShipping.asp. |
<%@ Language=VBScript %> <!-- #Include file="include/validatecheck.asp" --> <HTML> <!-- ManageShipping.asp - Handles the listing of the shipping rates. And, it provides functions for deleting shipping rates and adding new ones. --> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> </HEAD> <BODY> <!-- #include file="include/navinclude.asp" --> <% ' Create an ADO database connection set dbShipping = server.createobject("adodb.connection") ' Create the record set set rsShipping = server.CreateObject("adodb.recordset") ' Open the connection using our SQL Server DSN-less connection dbShipping.ConnectionString="Driver={SQL Server}; Server=cisdev.quinnipiac.edu;" & _ "Database=WildWillies;UID=cis; PWD=csatqu" dbShipping.Open ' Setup the Retrieve Shipping Rates stored ' procedure to retrieve all of the current ' shipping rates. sql = "execute sp_GetShippingRate" ' Execute the statement set rsShipping = dbShipping.Execute(sql) %> <!-- Start the form for updating the shipping --> <form method="post" action="UpdateShipping.asp"> <!-- Start the table to display the shipping rates. --> <table border="1" cellpadding="3" cellspacing="3"> <tr> <th>ID</th> <th>Low<BR>Quantity</th> <th>High<BR>Quantity</th> <th>Fee</th> <th>Delete</th> </tr> <% ' Loop through the shipping rates. do until rsShipping.EOF %>
' Loop back |
The form page should look like the following. Notice the two main forms, one for updating and deleting, the other for adding. |