Question LINQ update issue

JWilliams

New member
Joined
Aug 22, 2008
Messages
2
Programming Experience
3-5
Hi!
I'm experiencing the following issue with LINQ in my WinForms application:

One part of the application constantly updating database with the following code:
VB.NET:
  Dim SelectedComputers = From computer In db.Computers _
                                Where computer.ComputerName = ComputerName _
                                Select computer


        If SelectedComputers.Count <> 0 Then

            Using MyEnum = SelectedComputers.GetEnumerator

                MyEnum.MoveNext()
                MyEnum.Current.LastPing = DateTime.Now

                db.SubmitChanges()

            End Using


        End If
I can see that the code works perfectly through the Server Explorer (Show Table Data). The "LastPing" column is updating every few second.
However, the other part of program does not get the update. The result is always the same. Code:
VB.NET:
        Dim CurrentComputers = From computer In db.Computers _
                           Where computer.ComputerName = lvComputers.Items(0).Text _
                           Select computer


        For Each comp In CurrentComputers

            Console.WriteLine("Query result: " & comp.LastPing)

        Next
The date doesn't change.

What would you recommend to dig first?
 
Last edited by a moderator:
Back
Top