I'm having a problem with Link to SQL and updating a record, I think the problem is to with the current transaction based on the fact that I am looping through a connected data context:
Using db = New PostcodeLookupModelContainer()
Dim Stores = From b In db.lkpStores Where b.storeId ' = iStoreID ' Order By b.storeId
For Each store In Stores
Debug.Print(store.StorePostcode)
Dim newStore As New lkpStores()
newStore.depotId = store.depotId
newStore.StorePostcode = store.StorePostcode
newStore.depotId = store.depotId
newStore.DepotDistance = store.DepotDistance
db.lkpStores.Attach(newStore)
newStore.DepotDistance = 50
db.SaveChanges()
Next store
End Using
The line when I get the error is db.SaveChanges() and the error is 'New transaction is not allowed because there are other threads running in the session.'