[GIS] ArcObjects: How to insert data into a table

arccatalogarcmaparcobjectsattribute-tablec

I have a table in ArcCatalog named WorkOrderAss.

This table contains 3 columns: (OBJECTID, FeatureName, Name).

I want to insert data to this table from the code behind in C#.

Any help would be appreciated.

Best Answer

public void Irow(ITable table, string nameOfFrstField , string nameofSecField) {

            int fieldFrstIndex = table.FindField(nameOfFrstField);
            int fieldSecIndex = table.FindField(nameofSecField);
            //insert row
            IRow row = table.CreateRow();
            //initalize all of the default field values for the new row.
            IRowSubtypes rowSubTypes = (IRowSubtypes)row;
            rowSubTypes.InitDefaultValues();
            row.set_Value(fieldFrstIndex, "Value1");
            row.set_Value(fieldSecIndex, "Value2");
            row.Store();
}
Related Question