By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

Master-Detail Relationship

P: n/a
Hi all

I have created a master-detail relationship dataset under VS2005. However,
when I update the tables, it seems the foreign key information couldn't be
passed from the master table, therefore, the update is failed. Do you know
how to solve this problem?

Feb 23 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
While updating related tables in a dataset, it is important to update in the proper sequence to reduce the chance of violating the relation between tables. To prevent data integrity errors update the data source in the following sequence:

Child table: delete records.
Parent table: insert, update, and delete records.
Child table: insert and update records.

Private Sub UpdateDB()
Dim DeletedChildRecords As DataTable = _
Dim NewChildRecords As DataTable = _
Dim ModifiedChildRecords As DataTable = _
If Not DeletedChildRecords Is Nothing Then
End If
DACustomer.Update(DS, "Customer")
If Not NewChildRecords Is Nothing Then
End If
If Not ModifiedChildRecords Is Nothing Then
End If
Catch ex As Exception
' Update error, resolve and try again
End Try
End Sub

As an alternative download IdeaBlade’s DevForce Express and use that for ORM (I don’t work for them – but use it extensively)

Apr 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.