Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27225

VS 2005 Concurrency violation

$
0
0
I have the following very simple code and it baffles me why I'm getting a concurrency violation on this. I use this type of thing all the time and the only difference i see in this example is I am setting the values in columns "alternate1" and "alternate2" etc. before I update. These are all valid column names.
I am not including the code on the function _getalts because it returns data correctly each time. I already tried moving the update command and accept changes to the very end after it loops through the datarows, but I get the same concurrency error.

I would appreciate any help on this.

HTML Code:

OleDbDataAdapter1.Fill(DataSet11, "siegerhotels")

        Dim hod As String
        Dim recnum As Integer = 0
        Dim altnum As Integer = 0
        Dim date1 As Date
        Dim lat As Double
        Dim lon As Double

        Dim dr As DataRow
        For Each dr In DataSet11.Tables("siegerhotels").Rows

            recnum = recnum + 1
            hod = dr("HPROP_NO")
            lat = dr("lat")
            lon = dr("lon")
            date1 = dr("hoteldate")

            Dim dv As New DataView()
            dv = _getAlts(hod, lat, lon, date1)

            If dv.Count > 0 Then

                Dim n As Integer

                For n = 0 To dv.Table.Rows.Count - 1

                    If n = 5 Then Exit For
                    dr("ALTERNATE" & n + 1.ToString) = dv(n)("PROPNAME")
                    dr("ALTRATE" & n + 1.ToString) = dv(n)("USEPRICE")
                    dr("HOD" & n + 1.ToString) = dv(n)("SABRE_HOD")
                Next n

            End If
            OleDbDataAdapter1.Update(DataSet11)
            DataSet11.AcceptChanges()
        Next dr


Viewing all articles
Browse latest Browse all 27225

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>