SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 29th, 2003, 03:23 AM
tycoon tycoon is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 38 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 39 sec
Reputation Power: 0
Parent and Child Relationship On sql Server

Hi alll...........I'm Kindda stuck on relating two table(I include a bmp file to make sure u all understand what my problem is)..as U all can see from the bmp I supply with this message..I got 2 Table which is Master and Child table...the problem is I kindda want to make it like a Parent Child Relationship like In ms Access..What should i Do to....
Attached Files
File Type: zip prob.zip (31.2 KB, 161 views)

Reply With Quote
  #2  
Old December 29th, 2003, 12:48 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
I guess I'm not sure what you question is. Based on what you sent you have a relationship established, your didn't send information to state what kind of properties that your relationship has, but aside from that SQL is not Access. You can't create the relationships in the same way or display them the same way.

O yea, by word of advice: Yes Access and SQL can handle spaces in the field names, but I would never recommend. It makes everything harder in the long run.

S-

Reply With Quote
  #3  
Old December 30th, 2003, 04:53 AM
tycoon tycoon is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 38 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 39 sec
Reputation Power: 0
My problem i want the MasterId In table child will update automaticly based on table master masterId

Reply With Quote
  #4  
Old December 30th, 2003, 06:01 AM
tycoon tycoon is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 38 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 39 sec
Reputation Power: 0
well....as u all can from the image file attach with this message...i got two table which is
table master and table child.....what i wanna do is when a user enter a data into table child..
the field MasterId from the table child will automaticly update MasterId from the table master..
So the question is how do I manage to do this?.....

Reply With Quote
  #5  
Old December 30th, 2003, 12:48 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Not sure what you question is really asking so I will answer to possibiliities


1. Can I have the MasterID automatically be created when I create a child record that the master doesn't already exisit?

With Code

WHen you add a child record that has a master ID that doesn't exist you have to use code to identify that this is the case and add the master ID before addign the child record



2. When I add a child record can have the master ID automatically be populated in my child record so I don't have to enter it again.

With Code in a SQL enviroment
OR through use of Bound forms in VB (form-subform enviroment)

But is does have to exist somewhere as a variable

S-

Last edited by sbaxter : December 30th, 2003 at 12:58 PM.

Reply With Quote
  #6  
Old December 30th, 2003, 11:43 PM
tycoon tycoon is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 38 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 39 sec
Reputation Power: 0
Thanx "sbaxter" for your time in reviewing my msg...I was wondering could u...show me how to write the sql code for posibilities no 2....

Reply With Quote
  #7  
Old December 31st, 2003, 02:54 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
There isn't code in SQL. What I meant is the in using an SQL Server you have to use code to do your request.

In visual basic, for example, you could

Create a form where you add the master ID and then when you go to add the child record you would store the masterID in a variable to use when you go to enter the child record (that way you don't have to type it in again)

What are you going to design the date entry forms using?

S-

Reply With Quote
  #8  
Old January 1st, 2004, 01:12 AM
tycoon tycoon is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 38 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 39 sec
Reputation Power: 0
I'm going use dreaweaver mx to design the
date entry forms using..So will to Used Vb with dreamweave mx

Reply With Quote
  #9  
Old January 1st, 2004, 01:16 AM
tycoon tycoon is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 38 tycoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 39 sec
Reputation Power: 0
sorry..what I mean is will I be able to used Vb with dreamweave mx

Reply With Quote
  #10  
Old January 2nd, 2004, 01:54 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
There is two ways that you will be entering data

First

Master ID doesn't exist.

In this case you will go through the effort of adding the master the first time and store the master ID in a variable. You will either store it as a global variable that can be accessed by other forms or you will pass it to the that youe will enter the child information on using "openargs" (don't know if that will work in Dreamweaver) and use that information stored as part of your insert statement when adding it into your DB.


Second

Master ID already existis in the table.

You will go and select the master record that you wish to enter child information on and store that id in a variable and use that information stored as part of your insert statement when adding it into your DB.


You have to know what the MsterID is and include it as part of your insert statement when adding the child record or you can add the child record

Good-Luck

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Parent and Child Relationship On sql Server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT