ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data Namespace / InsertCursor Class / Insert Method
A RowBuffer with the field values to be set for the new row.
Example

In This Topic
    Insert Method (InsertCursor)
    In This Topic
    Inserts a new Row into the Table with a system-assigned object ID. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public long Insert( 
       RowBuffer rowBuffer
    )
    Public Function Insert( _
       ByVal rowBuffer As RowBuffer _
    ) As Long

    Parameters

    rowBuffer
    A RowBuffer with the field values to be set for the new row.

    Return Value

    The object ID of the newly-inserted row.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Using an Insert Cursor
    // Insert Cursors are intended for use in CoreHost applications, not Pro Add-ins
    public void UsingInsertCursor()
    {
      using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file"))))
      using (Table citiesTable = geodatabase.OpenDataset<Table>("name\\of\\cities_table"))
      {
        geodatabase.ApplyEdits(() =>
        {
          using (InsertCursor insertCursor = citiesTable.CreateInsertCursor())
          using (RowBuffer rowBuffer = citiesTable.CreateRowBuffer())
          {
            rowBuffer["State"] = "Colorado";
    
            rowBuffer["Name"] = "Fort Collins";
            rowBuffer["Population"] = 167830;
            insertCursor.Insert(rowBuffer);
    
            rowBuffer["Name"] = "Denver";
            rowBuffer["Population"] = 727211;
            insertCursor.Insert(rowBuffer);
    
            // Insert more rows here
            // A more realistic example would be reading source data from a file
    
            insertCursor.Flush();
          }
        });
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also