|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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....
|
|
#2
|
|||
|
|||
|
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- |
|
#3
|
|||
|
|||
|
My problem i want the MasterId In table child will update automaticly based on table master masterId
|
|
#4
|
|||
|
|||
|
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?..... |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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....
|
|
#7
|
|||
|
|||
|
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- |
|
#8
|
|||
|
|||
|
I'm going use dreaweaver mx to design the
date entry forms using..So will to Used Vb with dreamweave mx |
|
#9
|
|||
|
|||
|
sorry..what I mean is will I be able to used Vb with dreamweave mx
|
|
#10
|
|||
|
|||
|
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- |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Parent and Child Relationship On sql Server |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|