private MapInfo.Data.Table OpenDataBaseTable(MapInfo.Data.NamedConnectionInfo nci, string dbTableName) { String tableAlias = dbTableName + "_" + nci.Name.Replace(" ", "_").Replace(".", "_"); MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.GetTable(tableAlias); // we need to create a new table if there is no table in the catalog. if (table == null) { TableInfoServer tis = new TableInfoServer("tableInfoServer_" + dbTableName); tis.ConnectString = nci.ConnectionString; tis.Query = "select * from " + dbTableName; tis.Toolkit = this.GetServerToolkit(nci); tis.CacheSettings = new CacheParameters(CacheOption.On); tis.Alias = tableAlias; table = MapInfo.Engine.Session.Current.Catalog.OpenTable(nci.Name, tis); } return(table); }
private MapInfo.Data.Table OpenDataBaseTable(MapInfo.Data.NamedConnectionInfo nci, string dbTableName) { String tableAlias = dbTableName + "_" + nci.Name.Replace(" ", "_").Replace(".", "_"); MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.GetTable(tableAlias); // we need to create a new table if there is no table in the catalog. if(table == null) { TableInfoServer tis = new TableInfoServer( "tableInfoServer_" + dbTableName); tis.ConnectString = nci.ConnectionString; tis.Query = "select * from " + dbTableName; tis.Toolkit = this.GetServerToolkit(nci); tis.CacheSettings = new CacheParameters(CacheOption.On); tis.Alias = tableAlias; table = MapInfo.Engine.Session.Current.Catalog.OpenTable(nci.Name, tis); } return table; }