Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
3  
Is this table in SDE, file geodatabase? –  CaptDragon Jul 26 '12 at 13:36
    
Yes, it is SDE. –  RASHOMON Jul 26 '12 at 13:44
add comment

2 Answers

up vote 5 down vote accepted
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();
}
share|improve this answer
add comment

For better performance, consider using IRowBuffer and an insert cursor with client-side buffering enabled (e.g. pass in true for the useBuffering parameter of the ITable.Insert method).

See "Using insert cursors" in the Creating features help topic for more info.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.