AnsweredAssumed Answered

IFeatureSelection,SelectFeatures throwing error.

Question asked by sanjayjadhav on Jan 26, 2015
Latest reply on Feb 3, 2015 by sanjayjadhav



We have a simple code for selecting features based on attribute query using IFeatureSelection. However, it throws COMexception at the line where it selects the features. Error is Exception from HRESULT: 0x80041538.


Initially I suspected that problem would be with the syntax of the where clause, but even simpler where clauses like "OBJECTID = 500'" also throw error. I have confirmed that the features being queried actually exist in the feature class.Error screenshot is attached here.



Public Sub LayerSelectFeatures(ByRef pFlayer As IFeatureLayer, ByVal strFWhereClause As String, ByVal enumSelectionResult As esriSelectionResultEnum)           Try                         Dim pMxDoc As IMxDocument             pMxDoc = g_pApp.Document             Dim pMap As IMap             pMap = pMxDoc.FocusMap             Dim pActiveView As IActiveView             pActiveView = pMap               Dim pQueryFilter As IQueryFilter             pQueryFilter = New QueryFilterClass             pQueryFilter.WhereClause = strFWhereClause                          Dim pLayerSelection As IFeatureSelection             pLayerSelection = TryCast(pFlayer, ESRI.ArcGIS.Carto.IFeatureSelection)                              pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)             pLayerSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultAdd, False) 'Erractic Line             pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)               System.Runtime.InteropServices.Marshal.ReleaseComObject(pQueryFilter)             pQueryFilter = Nothing           Catch ex As Exception           End Try       End Sub


ArcMap Version : 10.2.1

Database: SDE on Oracle 11 g

Language : VB.Net


I would appreciate if I can get help to fix this issue.


PS: When I use esriSelectionResultNew instead of esriSelectionResultAdd, it works.