Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent and Child objects and foreign keys
Message
From
24/01/2007 04:09:12
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Parent and Child objects and foreign keys
Environment versions
Environment:
VB 8.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01188523
Message ID:
01188523
Views:
64
I need some advice.

I am trying to save a parent (doctor) and child (address) object in one hit in such a way that the parent key is auto placed into the child object. I did the following

In the address object i added the foreignkey assignment as follows

Public Sub New()
Me.TableName = "address"
Me.PrimaryKey = ""
Me.DefaultCommandType = CommandType.Text
Me.ForeignParentKeyField = "parent_PK"

then i added a property to doctor called address and registered it as a child object. Then I did the following code in my app test

'' Now we have an address pk we can create DR
Dim loDoctor As Doctor = New Doctor
loDoctor.NewRow()
loDoctor.Entity.First_name = "Erin"
loDoctor.Entity.Last_Name = "Noonan"
loDoctor.Entity.notify_emails = "sales@infotoday.com.au"

'' Create new address first
loDoctor.Address.NewRow()
loDoctor.Address.Entity.post_code = "2060"
loDoctor.Address.Entity.state = "NSW"
loDoctor.Address.Entity.street = "Walker St"
loDoctor.Address.Entity.street_no = "161"
loDoctor.Address.Entity.suburb = "North Sydney"
loDoctor.SaveRow()

this created bith parent and child objects but did not assign the parent key. Am i missing something?
Next
Reply
Map
View

Click here to load this message in the networking platform