Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 August 7th, 2003, 04:24 PM
Authorized User
 
Join Date: Jul 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reuse of ASP Code

I have created an online scheduling program (consisting of 14 .ASP files) for the nursery at the church. I need to do the exact same thing for 7 more functions (ushers, acolytes, etc). I am using FrontPage and am wary of <-include-> type statements due to the way FrontPage handles them. All of the functions will be identical other than populating different Schedule tables in a common database. Looking for ideas for how to do this the "RIGHT" way.

Rich
__________________
Ego is a faithful friend; He stays with us all the way to the crater.
 
Old August 8th, 2003, 07:44 AM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cant you pass different parameters to the same scheduling program for each category? like for example cant you query the db through the scheduling program for ushers to use the scheduling for ushers? etc., whats the db structure like? does each category has its own table?

 
Old August 8th, 2003, 08:19 AM
Authorized User
 
Join Date: Jul 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I currently have 4 tables:
     Members
     Events (ID, EventDate and ServiceDescriptionID)
     ServiceDescription (ID, ServiceDescription)
     NurserySchedule (ScheduleID, EventID, MemberID)

If I understand your suggestion, create a variable for the table name for modification of the type: (JavaScript)

var ScheduleName = new Array("Usher","Acolyte","Greeters")
var TargetTable = ScheduleName[0] + "Schedule";
INSERT INTO TargetTable
   ....

and add the tables UsherSchedule, AcolyteSchedule, GreetersSchedule, etc.

Would it make more sense to have multiple tables, one for each "function", or put a FunctionID (Usher, Acolyte, Greeter...) into the existing (renamed) Schedule Table and have 1 table hold all schedules?


 
Old August 8th, 2003, 08:33 AM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No I didnt mean that, where are you storing all your categories? is there a separate table for the categories? something like categories and have entries like ushers etc.,

 
Old August 8th, 2003, 08:39 AM
Authorized User
 
Join Date: Jul 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Currently, the NurserySchedule is the only one that exists. I have generated all the code I need for additions, deletions, modifications, etc. I need to do the same for the other functions, and rather than just copying the existing code 6 times, I am trying to design a more "elegant" solution

 
Old August 8th, 2003, 08:49 AM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On a quick thought the elegant way(again this is a 'quick thought') would be something like this

     Members
     Events (ID, EventDate and ServiceDescriptionID)
     ServiceDescription (ID, ServiceDescription)
     Categories(Categoryid,Categoryname)
     Schedule (ScheduleID, EventID, MemberID,Categoryid)
In that way you can create new categories and at the same time use the same code to schedule any of the categories.

 
Old August 8th, 2003, 10:20 AM
Authorized User
 
Join Date: Jul 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I like this setup. Eventually I am going to do a "MySchedule" button for the members to print out their own schedule. This setup will make that search much easier in 1 table rather than in 8.

Thanks for your help!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Updated Wrox Code Reuse Policy jminatel Wrox Book Feedback 2 July 1st, 2013 07:30 AM
Reuse Forms and part s of code thillai Visual Basic 2005 Basics 5 March 4th, 2008 10:40 AM
How to reuse my application ankur_bhargava2000 VB How-To 1 October 17th, 2005 12:49 PM
Reuse in ASP. rupen Classic ASP Basics 3 June 29th, 2005 10:12 AM





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