void ImportFeatures() { PClient.GDatabase objDB = _connection.Database as PClient.GDatabase; PClient.GTableDefs tblDefs = objDB.GTableDefs as PClient.GTableDefs; PClient.GTableDef aliasTable = tblDefs["GAliasTable"]; PClient.GField field = null; PClient.GRecordset dbRS = objDB.OpenRecordset("Select TableType, TableName From GAliasTable Where TableType='INGRFeatures'", PClient.GConstants.gdbOpenDynaset, null, null, null, null); string aliasTableName = null; while (!dbRS.EOF) { field = dbRS.GFields["TableName"]; aliasTableName = (string)field.Value; dbRS.MoveNext(); } dbRS.Close(); if (string.IsNullOrEmpty(aliasTableName)) { return; } //WriteEvent("INGRFeatures table: " + aliasTableName); dbRS = objDB.OpenRecordset("Select FeatureName From " + aliasTableName, PClient.GConstants.gdbOpenDynaset, null, null, null, null); while (!dbRS.EOF) { field = dbRS.GFields["FeatureName"]; string featureName = (string)field.Value; //WriteEvent(" Feature: " + featureName); ListViewItem item = new ListViewItem(featureName); item.SubItems.Add(""); item.Checked = true; mListView.Items.Add(item); dbRS.MoveNext(); } dbRS.Close(); }
bool ExportFeature(string featureName) { PClient.OriginatingPipe pipe; _connection.CreateOriginatingPipe(out pipe); pipe.Table = featureName; PClient.GRecordset recordset = pipe.OutputRecordset; int recordCount = recordset.RecordCount; if (recordCount == 0) { return(false); } _mapInfoService.InputRecordset = recordset; _mapInfoService.OutputFileName = System.IO.Path.Combine(folderBrowserDialog.SelectedPath, featureName); _mapInfoService.Execute(); return(true); }