ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / InsertCursor Class / Flush Method
Example

In This Topic
    Flush Method
    In This Topic
    Write all changes to the Table. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Sub Flush() 
    public void Flush()
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Remarks
    This method guarantees that changes are written to the table. Depending on the underlying datastore and the transaction model in use, edits may be flushed before this call is made.
    Example
    Using an Insert Cursor
    {
      // Insert Cursors are intended for use in CoreHost applications, not Pro Add-ins
      await QueuedTask.Run(() =>
      {
        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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also