Adding a new record in the parent table..

alander

Well-known member
Joined
Jun 26, 2007
Messages
120
Location
Singapore
Programming Experience
5-10
Hi, i got a problem here again..

Well, after all the helps u all have given me, i managed to finally complete everything i need to except for this one last part..


4ubs9yq.jpg


Now whenever i add a record on the parent table, i would expect the database to add one record to all the child tables as well, how do u achieve that?

I entered it stuff, however, the application only updates the parent table, the child table does not add a new record.. so i have to add a insert command to every child table everytime i press the new button?? or is there a easier way to go around doing it?

Any help will be appreicated
Thank you
 
Now whenever i add a record on the parent table, i would expect the database to add one record to all the child tables as well

Why? Do you not think it is possible to have e.g. a list of countries where one country has no subscribers? A list of parts that have no order because they have never been ordered?

If you want one parent and one child in each table for that parent, then it sounds like your data model is flawed, and you should have everything in one table.

I entered it stuff, however, the application only updates the parent table, the child table does not add a new record..
As noted, why should it? If every child must have a parent, then specifying that every parent must have one child creates a chicken and egg race condition - How would you add a parent if you first had to add a child that needs a parent added first?

so i have to add a insert command to every child table everytime i press the new button??
Yes

or is there a easier way to go around doing it?
No, but, what's so hard about it?

ParentBindSource.AddNew()
ParentBindSource.EndEdit()
Child1BindSource.AddNew()
Child1BindSource.EndEdit()
Child2BindSource.AddNew()
Child2BindSource.EndEdit()
...
 
Nvm i fixed it, it was a careless mistake in my dataset.. one of the relationship was set wrongly -.-
 
Last edited:
Back
Top