共用方式為


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使用 方法傳回已新增至 DataTable的新 DataRowView

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

適用於

另請參閱