Program crashes when finding features?

Jul 11, 2011 at 9:44 AM
Edited Jul 11, 2011 at 9:45 AM

I want to do a job to merge some polygons into one polygon.Following is the code. 

Program crashes at "featuresFound = fsSource.Find("[score] >= 30");". Could someone tell me why? Thanks in advance.

 

        public int MergePolygons()
        {
            FeatureSet fsDest = new FeatureSet(FeatureType.Polygon);

            FeatureSet fsSource = new FeatureSet(FeatureType.Polygon);
            fsSource.Open(@"D:\Data\src.shp");

            List<int> featuresFound = null;
            try
            {
                featuresFound = fsSource.Find("[score] >= 30");

                for (int i = 0; i < featuresFound.Count; i++)
                {
                    fsDest.AddFeature(fsSource.Features[featuresFound[i]]);
                }

                fsDest.UnionShapes(ShapeRelateType.All);

                fsDest.SaveAs(@"D:\Data\dest.shp", true);
            }
            catch
            {
            }

            fsDest.Close();
            fsSource.Close();

            return 0;
        }