Manson_Po
Manson_Po
2016-05-19 16:04

矢量图层遍历属性表某个字段居然出现了缺失波段属性的问题!!跪求大神解答!

出现问题的代码段如下:
IMap pMap = axMapControl1.Map;
ILayer pLayer = null;
pLayer = pMap.get_Layer(0);//获取第1个图层
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IFeatureClass pFeatureclass = pFeatureLayer.FeatureClass;
//IFields pFields1 = pFeatureclass.Fields;
for (int j = 0; j < pFeatureclass.Fields.FieldCount; j++)
{
IQueryFilter pQueryFilter1 = new QueryFilter();
pQueryFilter1.WhereClause = "name";
IFeatureCursor pCursor1 = pFeatureclass.Search(pQueryFilter1, true );//就是这句出现异常
IFeature pFeature1 = pCursor1.NextFeature();
IFields pFields1 = pFeatureclass.Fields;

                            然后抛出的异常是这样的:
                            ![图片说明](https://img-ask.csdn.net/upload/201605/19/1463673534_682574.png)

                            然后我在查看局部变量的时候发现了这个问题,不知道有没有关系:
                            ![图片说明](https://img-ask.csdn.net/upload/201605/20/1463673762_18499.png)

                            最后呢,我确定我的图层没问题,就是不知道为什么莫名其妙得出现了个波段缺失,求各位大神解答!!小的在此谢过了!
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换