Data seems not be loaded again...
Posted: Tue 29 Sep 2009 15:36
Hey
I use a Project wide DataContext The code in my class looks like this:
In a form I run the following code:
The data is saved correct to the database.
But when I use the following code (after submit changes):
The new data is not visible.
But when I call the following code after SubmitChanges, then it works as I want
Any suggestions to this? I don't think it is a good idea to dispose the DataContext each time I update my database
THX
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