DataView.AddNew 方法

定义

DataView 中添加新行。

public:
 virtual System::Data::DataRowView ^ AddNew();
public virtual System.Data.DataRowView AddNew ();
abstract member AddNew : unit -> System.Data.DataRowView
override this.AddNew : unit -> System.Data.DataRowView
Public Overridable Function AddNew () As DataRowView

返回

一个新 DataRowView 对象。

示例

以下示例使用 AddNew 方法返回 DataRowView 已添加到 的新 DataTable

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

    // Change values in the DataRow.
    rowView["ColumnName"] = "New value";
    rowView.EndEdit();
}
Private Sub AddNewDataRowView(view As DataView)
    Dim rowView As DataRowView = view.AddNew

    ' Change values in the DataRow.
    rowView("ColumnName") = "New value"
    rowView.EndEdit
End Sub

适用于

另请参阅