AnsweredAssumed Answered

VB.NET - cannot lock database table error

Question asked by cdebruin on Mar 12, 2012
Latest reply on Mar 12, 2012 by cdebruin
Hi all,

I'm attempting to move a point and have the attached line features move with it. It works the first time, bt the second time I get the error {"The database engine could not lock table 'DELTA_SanitaryLines_SHAPE_Index' because it is already in use by another person or process."}
I guess something I'm leaving something open programmatically as the database isn't physically open anywhere and I'm the only user/programmer on the project.
This is the line it doesn't like:

'Get and move attached sanlines
' We have to look for Sanlines that come into the manhole and also sanlines that leave from the manhole
' We will do this as two separate While loops
'Find San Lines with matching GfkMHto IDs
sanlineQueryFilter = New ESRI.ArcGIS.Geodatabase.QueryFilter
sanlineQueryFilter.WhereClause = "([GFKmhTo] = " & movedManholeGID & ") OR ([GFKmhFrom] = " & movedManholeGID & ")"

Dim sanlineFeatureCursor As IFeatureCursor = Nothing
sanlineFeatureCursor = sanlineFeatClass.Update(sanlineQueryFilter, False)
sanlineFeature = sanlineFeatureCursor.NextFeature

sanlineFeatureSelection = sanlineFeatLyr
sanlineFeatureSelection.SelectFeatures(sanlineQueryFilter, Carto.esriSelectionResultEnum.esriSelectionResultNew, False)

'Move sanline ToPoint to match location of moved manhole
While Not sanlineFeature Is Nothing
pLine = sanlineFeature.Shape
sanlineGfkMHfromVal = sanlineFeature.Value(sanlineGfkMHfromFld)
If sanlineGfkMHfromVal = movedManholeGID Then
pLine.ToPoint = movedPoint
Else
pLine.FromPoint = movedPoint
End If
lengthsanline = pLine.Length
sanlineFeature.Shape = pLine

sanlineFeature.Value(sanlineINVLENGTHfld) = Math.Round(lengthsanline)

StoreNameAndTime(sanlineFeature, "Edit")

sanlineFeatureCursor.UpdateFeature(sanlineFeature)
sanlineFeature = sanlineFeatureCursor.NextFeature
End While

sanlineFeatureCursor = Nothing

EndEditSession("sanMHmove")
pMap.ClearSelection()
m_focusmap.Refresh()

justPlunked = False

Any Ideas?

Outcomes