I use a Project wide DataContext The code in my class looks like this:
Code: Select all
Private Shared LinQProvider As VOPT.Voptneucontext.Voptneudatacontext
Public Sub Initialize()
LinQProvider = New VOPT.Voptneucontext.Voptneudatacontext(mySQL.GetConnectionString)
End Sub
Public Shared Function GetProvider() As Voptneudatacontext
Return LinQProvider
End Function
Public Shared Sub ReNewProvider()
LinQProvider.Dispose()
LinQProvider = New VOPT.Voptneucontext.Voptneudatacontext(mySQL.GetConnectionString)
End Sub
Code: Select all
LinqProvider.GetProvider.SubmitChanges()
But when I use the following code (after submit changes):
Code: Select all
Me.nKundendaten = (From Query In LinqProvider.GetProvider.Kundenstamms _
Where Query.Kundenid = KundenId).Single
Me.bsKundenstamm.DataSource = nKundendaten
But when I call the following code after SubmitChanges, then it works as I want
Code: Select all
LinqProvider.ReNewProvider()
THX