zoukankan      html  css  js  c++  java
  • MapXtreme2005中如何将一个已经存在的表索引化成为一个本地的表?

    003、如何将一个已经存在的表索引化成为一个本地的表???
    ISession session = MapInfo.Engine.Session.Current;

    Table tableToIndex = session.Catalog["DIJISHI"];
    MapInfo.Data.TableInfoNative ti = (MapInfo.Data.TableInfoNative)MapInfo.Data.TableInfoFactory.CreateFromFeatureCollection("NewTable", 
          MapInfo.Data.TableType.Native, tableToIndex);
    ti.Columns["PINYIN"].Indexed = true;
    ti.TablePath = "C:\\NewTable.tab";
    ti.WriteTabFile();

    MapInfo.Data.Table nativetable = MapInfo.Engine.Session.Current.Catalog.CreateTable(ti);
    nativetable.Close();
    nativetable = MapInfo.Engine.Session.Current.Catalog.OpenTable("C:\\NewTable.tab");

    MapInfo.Data.MIConnection con = new MapInfo.Data.MIConnection();
    con.Open();
    MapInfo.Data.MICommand com = con.CreateCommand();

    com = con.CreateCommand();
    com.CommandText = "Insert into " + nativetable.Alias + " Select * from " + tableToIndex.Alias;

    com.Prepare();
    com.ExecuteNonQuery();

    com.Dispose();
    con.Dispose();
    con.Close();
    注:也可以使用如下的函数来将上述代码进行封装:
    private MapInfo.Data.Table CreateIndexedNativeTableFromExisting(
      MapInfo.Data.Table tableToIndex,
      string columnAliasToIndex,
      string AliasForNewTable,
      string FilePathToSaveNativeTable,
      bool CloseOldTable)

  • 相关阅读:
    MongoDB的Spring-data-mongodb集成(Win10 x64) 第一章
    Linux 环境部署记录(三)
    onsubmit不起作用的原因
    sql server 将时间中的时分秒改为00:00:00
    js文件被浏览器缓存
    Action<>和Func<> 区别
    sql2008 express 实现自动备份
    Centos 7 无法上网的解决办法
    js 中的[] {}是什么意思
    js中var a={}什么意思
  • 原文地址:https://www.cnblogs.com/googlegis/p/2978837.html
Copyright © 2011-2022 走看看