MapXtreme 图层中图元搜索

private void fill_ft(string _findLayerName, string _findColumnName)
    {

    //获取层
        MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.GetTable(_findLayerName);

 

        if (table != null)
        {

            MIDataReader tr;//跟SQL的Reader类似

            MIConnection con = new MIConnection();

            MICommand tc = con.CreateCommand();

            tc.CommandText = "select " + _findColumnName + " from " + _findLayerName;

            con.Open();

            tr = tc.ExecuteReader(); //找到条件对应的图元

            DropDownList2.Items.Clear();
            DropDownList2.Items.Add("=请选择=");
            while (tr.Read())
            {

                DropDownList2.Items.Add(tr.GetString(0));

            }

            tc.Cancel();

            tc.Dispose();

            tr.Close();

            con.Close();

        }
    }

posted on 2013-02-25 10:34  读懂洋字码  阅读(230)  评论(0)    收藏  举报