tblInfoTemp.Columns.Add(ColumnFactory.CreateStyleColumn());
tblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn("NAME", 40));
tblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn("Dept", 15));
tblInfoTemp.Columns.Add(ColumnFactory.CreateIntColumn("Level")); //TableInfoMemTable是TableInfo类继承来的
tblTemp = cat.CreateTable(tblInfoTemp);
FeatureLayer lyr = new FeatureLayer(tblTemp);
MapControl1.Map.Layers.Add(lyr);
1.从ORACLE表中加载图层的问题。。。
MIConnection Connection=new MIConnection();
Connection.Open();
TableInfoServer tis1=new TableInfoServer("WORLD",
"SRVR=ora8i;UID=wzz;PWD=11111111",
"select * from world",MapInfo.Data.ServerToolkit.Oci);
MapInfo.Data.Table [] tables=new MapInfo.Data.Table[2];
tables[0]=Connection.Catalog.OpenTable(tis1);
TableInfoServer tis2=new TableInfoServer("WORLDCAP",
"SRVR=ora8i;UID=wzz;PWD=11111111",
"select * from worldcap",MapInfo.Data.ServerToolkit.Oci);
tables[1]=Connection.Catalog.OpenTable(tis2);
MapControl1.Map.Load(new MapInfo.Mapping.MapTableLoader(tables));
2.存在SqlSever中XY坐标点的绑定代码
//XY绑定:含有x,y坐标点的图层放置在Sql Server中,按xy坐标生成点图层
//1.要在存在该表的中建立MAPINFO_MAPCATALOG表,否则会报错:
//"An unhandled exception of type 'MapInfo.Data.TableException' occurred in mapinfo.coreengine.dll.
//Additional information: 不能打开表。mapxtreme ODBC 错误: ODBC RC=-1, ODBC SQLState=S0002, DBMS RC=208, DBMS Msg=[Microsoft][ODBC SQL Server Driver][SQL Server]对象名 'MAPINFO.MAPINFO_MAPCATALOG' 无效。
//2.要含xy坐标点的表建立主键,否则会报错:
//"Additional information: 不能打开表。因为不能识别唯一键,不能访问远程数据。"
//建立XY空间方案
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-27878-6.html
旅沪比这条船舰龄大点