AddNew Method

DataView.AddNew Method ()

 

Adds a new row to the DataView.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

public virtual DataRowView AddNew()

Return Value

Type: System.Data.DataRowView

A new DataRowView object.

The following example uses the AddNew method to return a new DataRowView that has been added to the DataTable.

private void AddNewDataRowView(DataView view)
{
    DataRowView rowView = view.AddNew();

    // Change values in the DataRow.
    rowView["ColumnName"] = "New value";
    rowView.EndEdit();
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft