读书人

AE属性表查询解决办法

发布时间: 2012-12-27 10:17:10 作者: rapoo

AE属性表查询
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Display;

namespace WindowsFormsApplication8
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

}
public void Itable2Dtable()
{
IFields pFields;
pFields = pFeatureLayer.FeatureClass.Fields;
dtGridView.ColumnCount = pFields.FieldCount;
for (int i = 0; i < pFields.FieldCount; i++)
{
string fldName = pFields.get_Field(i).Name;
dtGridView.Columns[i].Name = fldName;
dtGridView.Columns[i].ValueType
System.Type.GetType(ParseFieldType(pFields.get_Field(i).Type));
}
IFeatureCursor pFeatureCursor;
pFeatureCursor = pFeatureLayer.FeatureClass.Search(null, false);
IFeature pFeature;
pFeature = pFeatureCursor.NextFeature();
while (pFeature != null)
{
string[] fldValue = new string[pFields.FieldCount];

for (int i = 0; i < pFields.FieldCount; i++)
{
string fldName;
fldName = pFields.get_Field(i).Name;


if (fldName==pFeatureLayer .FeatureClass .ShapeFieldName)
{
fldValue[i] = Convert.ToString(pFeature.Shape.GeometryType);
}
else
fldValue[i] = Convert.ToString(pFeature.get_Value(i));
}
dtGridView.Rows.Add(fldValue);
pFeature = pFeatureCursor.NextFeature();

}

}

}
}

错误5只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs3817WindowsFormsApplication8
错误1未能找到类型或命名空间名称“IFields”(是否缺少 using 指令或程序集引用?)D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs3113WindowsFormsApplication8
错误8未能找到类型或命名空间名称“IFeatureCursor”(是否缺少 using 指令或程序集引用?)D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs4113WindowsFormsApplication8
错误10未能找到类型或命名空间名称“IFeature”(是否缺少 using 指令或程序集引用?)D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs4313WindowsFormsApplication8
错误2当前上下文中不存在名称“pFeatureLayer”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs3223WindowsFormsApplication8
错误9当前上下文中不存在名称“pFeatureLayer”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs4230WindowsFormsApplication8
错误11当前上下文中不存在名称“pFeatureLayer”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs5334WindowsFormsApplication8
错误7当前上下文中不存在名称“ParseFieldType”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs3937WindowsFormsApplication8
错误3当前上下文中不存在名称“dtGridView”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs3313WindowsFormsApplication8
错误4当前上下文中不存在名称“dtGridView”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs3717WindowsFormsApplication8
错误6当前上下文中不存在名称“dtGridView”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs3817WindowsFormsApplication8
错误12当前上下文中不存在名称“dtGridView”D:\AE开发学习\winform\WindowsFormsApplication8\WindowsFormsApplication8\Form2.cs6017WindowsFormsApplication8
为什么会有这么多错误,求解释,非常谢谢!
[解决办法]
命名空间全部添加引用了?

读书人网 >.NET

热点推荐