DataView.Delete(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
刪除指定索引處的資料列。
public:
void Delete(int index);
public void Delete (int index);
member this.Delete : int -> unit
Public Sub Delete (index As Integer)
參數
- index
- Int32
要刪除的資料列索引。
範例
下列範例會 Delete 使用 方法來刪除數據列。
Private Sub DeleteRow(view As DataView, val As String)
' Find the given value in the DataView and delete the row.
Dim i As Integer = view.Find(val)
If i = -1 Then
' The value wasn'table found
Console.WriteLine("Value not found in primary key column")
Exit Sub
Else
view.Delete(i)
End If
End Sub
備註
刪除 DataRow之後,狀態會變更為 DataViewRowState.Deleted
。 您可以在上DataTable呼叫 RejectChanges 來復原刪除。