All Bookings
Click Detail for details
or,
Click Delete to delete the engagement and add the date back to available dates
Admin Home Page |
Add/Remove
Available Dates
| CompanyName | Phone | City | Date | Details | ||
|---|---|---|---|---|---|---|
| Database Results Error The database connection named 'fredtest' is undefined. This problem can occur if: * the connection has been removed from the web * the file 'global.asa' is missing or contains errors * the root folder does not have Scripting permissions enabled * the web is not marked as an Application Root | ||||||
How To...
This page contains a database results region with hyperlinks that pass parameters to the Details.asp and Deletebooking.asp pages.
Insert > Database Results.
Select you connection and move to step two.
We are going to use a custom query because we want to pull information from
all three tables in the database based on the DateID contained in both the
bookings and dates tables and the CompanyID in both the bookings and company
tables. To do this, we are first going to create an Alias for each table and
then the WHERE statement will compare matching values between the tables***(More
info).

Continue on to step Three and click on Edit List. Because of the query we
created above, we will have available all fields from each table. We did it this
way for simplicity. To make this code more efficient, you would only pull the
fields you want to display in the query. Edit your list as follows:

Notice that we left two extra fields that we are not displaying in our final table. This is because of a bug in FrontPage that only allows you to add one extra column to a database results region table. We will use these two extra columns to build the Details and Delete fields.
Finish the wizard.
Now we need to create the hyperlinks to to the Details and Delete pages. Start by deleting the db results fields "Booked" and "DateID".
In the first column, type: Details, highlight it, right click on it and select edit hyperlink.
Select Details.asp page (or just type it in if you have not yet created this
page) and then click parameters, and click add, choose BookingID from the first
drop down and make sure that bookingID is also in the second dropdown choose ok.
The dialog should look like this:

We are going to repeat these steps for the Delete page with one additional
twist: We are going to pass two parameters to the delete page. 1) to delete the
booking from the bookings table and 2) add the date back to the list of
available dates. The Hyperlink Parameters dialog should look like this:

As a final touch, we made the Email field a hyperlink incase the admin wanted to email the company rep. To do this, highlight the <<email>> field, right click on it and select hyperlink from the pop up.
Again we are going to select the Parameters button and then choose the email field this time. Click OK.
Back in the Hyperlink Properties dialog, you want the information in the URL
box to look like this:
mailto:<%=FP_FieldURL(fp_rs,"Email")%>
***More Info: Remember that the database contains three tables: Bookings, Company and Dates. The Company and Dates tables contain a list of companies and a list of dates available to be booked. When a company books a date, the ID fields for each (companyID and dateID) are written to the bookings table, not all of the information.
Since we want to display the actual company name and the actual date, not just the ID fields, we have to match the information from all tables. Thus, the WHERE statement matches the values of the companyID in both the Bookings table and the Company table and it matches values between dateID in the Bookings table and Dates table.
Alias: An alias is used to assign a value to a table to make it easier to type the query. Review this example:
SELECT A.*, B.*, C.*
FROM Bookings A, Company B, Dates C
This would be just like typing:
SELECT * FROM Bookings, Company, Dates