<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: VB.NET - cannot lock database table error in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-cannot-lock-database-table-error/m-p/113693#M2992</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anytime you use an ArcObjects cursor (ICursor or IFeatureCursor), you need to release the reference as soon as you're done with it by calling Marshal.FinalReleaseComObject.&amp;nbsp; The same is true for any IFeature/IRow objects you're using.&amp;nbsp; If you're using IFeature/IRow objects within a loop, then call FinalReleaseComObject on them before setting the feature/row variable to the next object in the cursor.&amp;nbsp; You can also use ESRI's ComReleaser class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Doing this should release any locks on the database.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Mar 2012 12:36:38 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2012-03-12T12:36:38Z</dc:date>
    <item>
      <title>VB.NET - cannot lock database table error</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-cannot-lock-database-table-error/m-p/113692#M2991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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."}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the line it doesn't like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; 'Get and move attached sanlines&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' We have to look for Sanlines that come into the manhole and also sanlines that leave from the manhole&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' We will do this as two separate While loops&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; 'Find San Lines with matching GfkMHto IDs&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineQueryFilter = New ESRI.ArcGIS.Geodatabase.QueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineQueryFilter.WhereClause = "([GFKmhTo] = " &amp;amp; movedManholeGID &amp;amp; ") OR ([GFKmhFrom] = " &amp;amp; movedManholeGID &amp;amp; ")"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim sanlineFeatureCursor As IFeatureCursor = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeatureCursor = sanlineFeatClass.Update(sanlineQueryFilter, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeature = sanlineFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeatureSelection = sanlineFeatLyr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeatureSelection.SelectFeatures(sanlineQueryFilter, Carto.esriSelectionResultEnum.esriSelectionResultNew, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; 'Move sanline ToPoint to match location of moved manhole&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; While Not sanlineFeature Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pLine = sanlineFeature.Shape&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineGfkMHfromVal = sanlineFeature.Value(sanlineGfkMHfromFld)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; If sanlineGfkMHfromVal = movedManholeGID Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pLine.ToPoint = movedPoint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pLine.FromPoint = movedPoint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; lengthsanline = pLine.Length&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeature.Shape = pLine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeature.Value(sanlineINVLENGTHfld) = Math.Round(lengthsanline)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; StoreNameAndTime(sanlineFeature, "Edit")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeatureCursor.UpdateFeature(sanlineFeature)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeature = sanlineFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End While&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; sanlineFeatureCursor = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; EndEditSession("sanMHmove")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pMap.ClearSelection()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; m_focusmap.Refresh()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; justPlunked = False&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any Ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2012 12:13:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-cannot-lock-database-table-error/m-p/113692#M2991</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2012-03-12T12:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: VB.NET - cannot lock database table error</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-cannot-lock-database-table-error/m-p/113693#M2992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anytime you use an ArcObjects cursor (ICursor or IFeatureCursor), you need to release the reference as soon as you're done with it by calling Marshal.FinalReleaseComObject.&amp;nbsp; The same is true for any IFeature/IRow objects you're using.&amp;nbsp; If you're using IFeature/IRow objects within a loop, then call FinalReleaseComObject on them before setting the feature/row variable to the next object in the cursor.&amp;nbsp; You can also use ESRI's ComReleaser class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Doing this should release any locks on the database.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2012 12:36:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-cannot-lock-database-table-error/m-p/113693#M2992</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-03-12T12:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: VB.NET - cannot lock database table error</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-cannot-lock-database-table-error/m-p/113694#M2993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much, it works perfectly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2012 14:27:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-cannot-lock-database-table-error/m-p/113694#M2993</guid>
      <dc:creator>Corbinde_Bruin</dc:creator>
      <dc:date>2012-03-12T14:27:26Z</dc:date>
    </item>
  </channel>
</rss>

