lionel.slade

Select set is full of null values when selecting many records

Discussion created by lionel.slade on Feb 10, 2012
Latest reply on Feb 10, 2012 by Neil
Hi,

I have this function which works fine when select a few hundred records, but fails when selecting more.  The pFeature is full of nulls when you select the larger number of records.  Backend is an SQL SDE server.

Anyone have any ideas?

      /// <summary>
        /// Selects geometry features from the Map
        /// </summary>
        /// <param name="pGeometry">the geometry you want to select by</param>
        /// <returns>A list of feature objects</returns>
        public List<IFeature> SelectFeaturesByShape(IGeometry pGeometry)
        {
            ISelectionEnvironment pSelectionEnvironment = new SelectionEnvironmentClass();
            pSelectionEnvironment.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
            pMap.SelectByShape(pGeometry, pSelectionEnvironment, false);
            List<IFeature> list = new List<IFeature>();
            IEnumFeature pEnumFeature = pMap.FeatureSelection as IEnumFeature;
            IFeature pFeature = pEnumFeature.Next();
            while (pFeature != null)
            {
                list.Add(pFeature);
                string eventGuid = (string)pFeature.get_Value(pFeature.Fields.FindField("EVENT_GUID")); // just here for debugging
                System.Diagnostics.Debug.WriteLine(eventGuid);// just here for debugging
                pFeature = pEnumFeature.Next();
            }

            return list;
        }

Outcomes