Created
April 7, 2015 21:55
-
-
Save alamsal/221a238dbfdd217d85ae to your computer and use it in GitHub Desktop.
Update GDB tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMxDocument pMxDocument = ArcMap.Application.Document as IMxDocument; | |
IMap pMap = pMxDocument.FocusMap; | |
ILayer pLayer = pMap.get_Layer(0); | |
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer; | |
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass; | |
IFields pFields = (IFields)pFeatureClass; | |
ITable pTable = (ITable)pFeatureClass; | |
ICursor pCursor = pTable.Search(null, false); | |
IRow pRow = pCursor.NextRow(); | |
while (pRow != null) | |
{ | |
string.IsNullOrEmpty(output); | |
for (int i = 0; i <= pFields.FieldCount - 1; i++) { | |
output += pFields.Field(i).Name + ": " + pRow.Value(i).ToString + Constants.vbNewLine; | |
} | |
MessageBox.Show(pRow.get_Value(fldIndex).ToString()); | |
pRow = pCursor.NextRow(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMxDocument pMxDocument = ArcMap.Application.Document as IMxDocument; | |
IMap pMap = pMxDocument.FocusMap; | |
ILayer pLayer = pMap.get_Layer(0); | |
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer; | |
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass; | |
IFields pFields = (IFields)pFeatureClass; | |
ITable pTable = (ITable)pFeatureClass; | |
ICursor pCursor = pTable.Search(null, false); | |
string[] FieldNames = {"Name", "Address", "City"}; | |
string output = null; | |
IRow pRow = pCursor.NextRow(); | |
while (pRow != null) | |
{ | |
string.IsNullOrEmpty(output); | |
foreach (string fieldName in FieldNames) { | |
output += fieldName + ": " + pRow.Value(pFields.FindField(fieldName)).ToString + Constants.vbNewLine; | |
} | |
MessageBox.Show(output); | |
pRow = pCursor.NextRow(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment