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。 你可以透過呼叫 RejectChangesDataTable. 來回滾刪除。