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 Next Dim dKunde = (From Query In myDataContext.Kundenstamms Where _ Query.Kundenid = sKundenID).Single myDataContext.Kundenstamms.DeleteOnSubmit(dKunde) End If Next LinqProvider.SaveDataContext(myDataContext)
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.