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 February 22nd, 2004, 01:48 AM
Authorized User
 
Join Date: Jan 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default What's the best way to do this?

I'm having a confusing time with this problem...Hopefully someone can help!!!(and I'm sure someone can...)

I'm trying to organize contacts. There is tblAdmin, tblPTO, tblStaff, tblStudents. Is there a way to have ONE form to fill out and something in there to specify which table the information should go in? Or is there another way I can go about doing this? Please help!

 
Old February 22nd, 2004, 05:48 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Do all these people share the same characteristics? If so, you should redesign your database, drop all four tables, and create a new one called Contacts. This Contact table then has a ContactTypeID that points to a table called ContactType. The latter table stores the types of contacts you have.

This way, you can have one form that inserts data in one table. To distinguish between the type of contact, you could display a drop-down list with the various contact types. Under the hood, the ID of the ContactType can be saved in the database (in the ContactTypeID column).

Does this make sense?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 22nd, 2004, 01:45 PM
Authorized User
 
Join Date: Jan 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Some of them have different characteristics...Like the tblStaff would have their office hours. Students would have parent's names. From these tables, they will login too. They will each have a username, but staff will have a different "management" area than the students and PTO...

 
Old February 22nd, 2004, 11:46 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

You could have one table for general contact info (name, email, phone, etc.) and then have corresponding tables for admin, pto, staff, students that maintain further info on the user. Just make sure you have a UserId field in each. This would allow some flexibility to cover instances where a user may be an admin as well as a staff member for example. As far as determining which tables to write data to, you can pass a hidden value from the form to whatever page processes those updates.

Dave









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