Forums

ASP

This topic is locked

ASP Upload and Access design

Posted 14 Jan 2003 22:25:48
1
has voted
14 Jan 2003 22:25:48 Anonymous User posted:
Hello everyone,

I just bought ASP Upload in order to simplify the process of adding stories and photos to my News application. I'm just not sure if my database design is correct at this point. The problem is that I have stories and I have photos. Sometimes they are related and sometimes they aren't. I had assumed that the best way to work this would be to have the photos in a separate table with a lookup to the story table when appropriate. The problem is it doesn't seem to me that the stories would then be associated to their photos from the other direction (so to speak). It aslo seems that since I can upload the photo and insert the database record at the same time, there's no reason to handle the association via a lookup in a "step 2" upload.

I need to be able to query the database to look up the top 3 stories in a catagory and have them display with their photos (if any), or pull the top 3 photos and have them show up with the associated story.

I'm hoping someone can direct me as to whether it would matter which way I slice this. I'd just build it and see what happens, but I'm on a tight deadline and can't lose time experimenting.

Thanks for anyone who can help.

Why be difficult when you can be impossible?

Replies

Replied 15 Jan 2003 01:51:32
15 Jan 2003 01:51:32 Chris Rowe replied:
I had the same problem, the site I was designing was for a commercial real estate company. They had new properties to add but didn't always have images to go along with it. So in the control panel I had a section to add a property, this would add all of the property information and assign a unique ID (PropID). Then on another portion of the control panel was an upload area. On this page I had a simple drop down menu with all of the properties and the corresponding PropID as values. Then they could choose which property to associate the image with. At that point I applied an insert behavior, took the file field(image upload field) renamed the image to associate with the PropID and it was done. I hope that helps. Sorry if it didn't.
Replied 15 Jan 2003 02:04:42
15 Jan 2003 02:04:42 Anonymous User replied:
Actually, that's very helpful. My only question is whether that system would allow you to pull up the photos, with the associated story if there is one (again, the photos don't necessarily have an associated story)?

Why be difficult when you can be impossible?
Replied 15 Jan 2003 02:13:56
15 Jan 2003 02:13:56 Chris Rowe replied:
I hope I'm understanding you correctly. If you want to pull up the story and the associated photo, just create a recordset that pulls up the story and the image:

Select *
From Stories, Images
Where Stories.StoryID = Images.StoryID
Order By Stories.DateEntered Desc

I'm not sure about your skill level but that might help. This would pull up the most recent story and associated image. If you wanted to pull up the 3 most recent stories and images, use the repeat region behavior and set the quantity to 3. Also, don't use the Select * if you don't need every field. It overloads the server and your response time might be affected.
Replied 15 Jan 2003 02:26:26
15 Jan 2003 02:26:26 Anonymous User replied:
Well my skill level is low, but I think I have a grasp on the concepts. What I'm wondering is whether this works:

1) Create new story record in database with a unique StoryID

2) Upload the Photo to the server and add an entry for which story it goes to (StoryID) via a lookup

3) Create a page that calls the last three Stories with their Photos

4) Create a page that calls the last three Photos with their Stories (if any)

All of this while knowing that some stories won't have photos, and some photos won't have stories. It seems to me that this should work out fine, but I just can't tell if there is a flaw in the logic. I am so close to deadline on this that I just want to be sure that this won't create problems down the road that I can't forsee due to lack of experience...

Thank you so much for helping me through this!

Why be difficult when you can be impossible?
Replied 15 Jan 2003 02:32:06
15 Jan 2003 02:32:06 Chris Rowe replied:
Your logic seems fine. If you have problems, just post to the board. There's usually someone around that will have an answer. Good Luck!
Replied 15 Jan 2003 18:54:33
15 Jan 2003 18:54:33 Anonymous User replied:
Well I started charging along and found where the hole in my logic was. It was made clear when I attempted to make the upload and insert page. I know that it's technically possible to insert to two tables at the same time while uploading a file, but it's far from easy. This helped me realize that there was no reason to story the photos in a photo table and the stories in a photo table when they were so closely related. Instead I'm putting them all into an "Item" table that will have a column that tracks whether the item is a story, a photo, or both. I had been trying this approach previously, but with the Item type tracking handled in a third table. I'm already cruising right along (for the time being) with the new design. I guess sometimes you just have to do somehting in order to see why it doesn't work. Thanks again for all your help thtough.

Why be difficult when you can be impossible?

Reply to this topic