zoukankan      html  css  js  c++  java
  • 我研究出来的属性查询,贴自己的代码,请大家指教

    //把所有的字段都读进来

    private void Form2_Load(object sender, EventArgs e)

            {
                
                int i;
                ILayer pLayer=mFormShow1.axMapControl1.Map.get_Layer(0);
                IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                IField pField;
                for (i = 0; i < pFeatureClass.Fields.FieldCount; i++)
                {
                    pField = pFeatureClass.Fields.get_Field(i);
                    comboBox1.Items.Add(pField.Name);
                }


            }
    //根据条件进行查询
            private void button1_Click(object sender, EventArgs e)
            {
                
                ILayer pLayer = mFormShow1.axMapControl1.get_Layer(0);
                IGeoFeatureLayer pGeoFeatureLayer = (IGeoFeatureLayer)pLayer;
                ITable pTable = (ITable)pGeoFeatureLayer;
                IQueryFilter pQueryFilter = new QueryFilterClass();

                IFeatureCursor pFeatureCursor;
                ICursor pCursor;
                IFeature pFeature;

                pQueryFilter.WhereClause = comboBox1.Text + comboBox2.Text + textBox1.Text;
                pCursor = pTable.Search(pQueryFilter, true);
                pFeatureCursor = (IFeatureCursor)pCursor;

                pFeature = pFeatureCursor.NextFeature();

                while (pFeature != null)
                {
                    mFormShow1.axMapControl1.Map.SelectFeature(pGeoFeatureLayer, pFeature);
                    pFeature = pFeatureCursor.NextFeature();
                
                }
                mFormShow1.axMapControl1.Refresh();
                int RowCount = pTable.RowCount(pQueryFilter);
                MessageBox.Show(RowCount.ToString());



            }
  • 相关阅读:
    消息中间件与kafka(二)
    维度建模基本概念(二)
    阿里开源canal
    ETL-kettle报错--org.gjt.mm.mysql.Driver
    消息中间件与rabbitmq(一)
    python装饰器--这个很pythonic
    Swift开发小技巧--识别选中照片中的二维码
    Swift开发小技巧--扫描二维码,二维码的描边与锁定,设置扫描范围,二维码的生成(高清,无码,你懂得!)
    Swift开发小技巧--自定义转场动画
    Swift基础--通知,代理和block的使用抉择以及Swift中的代理
  • 原文地址:https://www.cnblogs.com/zhangjun1130/p/1400078.html
Copyright © 2011-2022 走看看