zoukankan      html  css  js  c++  java
  • MapInfo Update Feature

    程序如下:

     1   private void updateFeatureToolStripMenuItem_Click(object sender, EventArgs e)
     2        {
     3            try
     4            {
     5                MapInfo.Data.Table CNTable = MapInfo.Engine.Session.Current.Catalog.GetTable("Testworld");
     6                MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("Country='China'");
     7                MapInfo.Data.IResultSetFeatureCollection irfc = MapInfo.Engine.Session.Current.Catalog.Search(CNTable, si);
     8                Feature ftr = irfc[0];
     9                ftr["Country"= "China";
    10               // CNTable.UpdateFeature(ftr);
    11                MIConnection conn = new MIConnection();
    12                conn.Open();
    13                MICommand cmd = conn.CreateCommand();
    14                cmd.CommandText = "update " + CNTable.Alias + " set obj=@obj,Country =@name where MI_Key =@MIKEY";
    15                cmd.Parameters.Add("@obj", ftr.Geometry);
    16                cmd.Parameters.Add("@name""中国");
    17                cmd.Parameters.Add("@MIKEY", ftr.Key);
    18                cmd.ExecuteNonQuery();
    19                
    20                //change style
    21                MapInfo.Styles.CompositeStyle cs = new MapInfo.Styles.CompositeStyle();
    22                MapInfo.Styles.BitmapPointStyle bmpStyle = new MapInfo.Styles.BitmapPointStyle();
    23                bmpStyle.Name = "YIEL2-32.BMP";
    24                bmpStyle.PointSize =28;
    25                cs.SymbolStyle = bmpStyle;            
    26            
    27            }

    28            catch (Exception ex)
    29            {
    30                MessageBox.Show(ex.ToString());
    31            }

    32        }
  • 相关阅读:
    GL_LINES_ADJACENCY_EXT等
    Using ASP.NET Sessions from WCF
    Device Contexts, CDC, CPaintDC,CClientDC,CWindowDC,CMetaFileDC
    First Win32 App, 第一个Win32 GUI程序
    MFC Windows程序设计:第二版/(美)帕罗赛斯
    Interlocked 使用
    What are the differences between SRAM and DRAM?
    C++虚函数示例
    First MFC
    WinAPI first gui, 2nd edition, from sun xin
  • 原文地址:https://www.cnblogs.com/abcdwxc/p/1012424.html
Copyright © 2011-2022 走看看