CRUD not supported?

CRUD not supported?

Postby Zero-G. » Thu 27 Jan 2011 15:35


I have a problem with a update/delete szenario.
I have a Master/Detail szenario for customers.
If a customer is in the db twice, then I will give them together, so I do the following:

I give the ID of the detail from on Customer to the other. Then I delete the customer.
I am doing this, by running the following code:
Code: Select all
Dim sKundenID As Int64 = 0
                    For Each cRow In GridEX1.GetCheckedRows
                        sKundenID = CLng(cRow.Cells("KundenID").Value)
                        If sKundenID > 0 Then
                            Dim aKunden = From Query In myDataContext.Auftrags Where _
                                          Query.Kundenid = sKundenID

                            For Each aKunde In aKunden
                                aKunde.Kundenid = myKundenID
                            Dim dKunde = (From Query In myDataContext.Kundenstamms Where _
                                          Query.Kundenid = sKundenID).Single
                        End If

The problem is, that I get an error: 1 of 2 updates failed
By looking on the output window, I saw, that the DELETE Statement of the customer is fired, before the Update statement of the customersdetail is fired.

Please give me some advise to this.
Posts: 390
Joined: Sat 09 Dec 2006 12:20

Postby StanislavK » Mon 31 Jan 2011 17:13

Thank you for your report, we've reproduced the error. We will investigate it and inform you about the results as soon as possible.

As a workaround, you can perform the update before the deletion with two calls of SubmitChanges(). To ensure that either both changes were performed or both were not, you can, e.g., explicitly start a transaction on the DataContext's connection:
Code: Select all
Dim transaction = [myDataContext].Connection.BeginTransaction()

(perform updates)

(perform deletions)


JIC: the recommended way of assigning a 'detail' entity to another 'master' entity is to change the EntityRef property instead of the master_id field. The point is that LinqConnect controls graph consistency with the help of EntityRef properties, whereas changing the master_id field directly may lead to a situation when a 'detail' refers a 'master' that does not have this 'detail' in its Details collection. For more information about this, please refer, e.g., to
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby StanislavK » Thu 10 Feb 2011 17:41

We have fixed the error with incorrect order of performing update commands. The fix is available in the new 2.20.12 version of LinqConnect (and in the new builds of the data providers as well). The new build can be downloaded from
(the trial and free versions) and from Registered Users' Area (for users with active subscription only):

For the detailed information about the fixes and improvements available in LinqConnect 2.20.12, please refer to
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Return to LinqConnect (LINQ to SQL support)