Page 1 of 1

Data seems not be loaded again...

Posted: Tue 29 Sep 2009 15:36
by Zero-G.
Hey
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
In a form I run the following code:

Code: Select all

            LinqProvider.GetProvider.SubmitChanges()
The data is saved correct to the database.
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
The new data is not visible.
But when I call the following code after SubmitChanges, then it works as I want

Code: Select all

LinqProvider.ReNewProvider()
Any suggestions to this? I don't think it is a good idea to dispose the DataContext each time I update my database


THX

Posted: Thu 01 Oct 2009 09:02
by AndreyR
I tried to reproduce the problem and failed.
Could you please make a small test project (with one table, to simplify it) and send it to me?