本文整理匯總了VB.NET中System.Data.DataRowState枚舉的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataRowState枚舉的具體用法?VB.NET DataRowState怎麽用?VB.NET DataRowState使用的例子?那麽, 這裏精選的枚舉代碼示例或許可以為您提供幫助。
在下文中一共展示了DataRowState枚舉的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: DemonstrateRowState
Private Sub DemonstrateRowState()
'Run a function to create a DataTable with one column.
Dim dataTable As DataTable = MakeTable()
Dim dataRow As DataRow
' Create a new DataRow.
dataRow = dataTable.NewRow()
' Detached row.
Console.WriteLine(String.Format("New Row {0}", dataRow.RowState))
dataTable.Rows.Add(dataRow)
' New row.
Console.WriteLine(String.Format("AddRow {0}", dataRow.RowState))
dataTable.AcceptChanges()
' Unchanged row.
Console.WriteLine(String.Format("AcceptChanges {0}", dataRow.RowState))
dataRow("FirstName") = "Scott"
' Modified row.
Console.WriteLine(String.Format("Modified {0}", dataRow.RowState))
dataRow.Delete()
' Deleted row.
Console.WriteLine(String.Format("Deleted {0}", dataRow.RowState))
End Sub
Private Function MakeTable() As DataTable
' Make a simple table with one column.
Dim dt As New DataTable("dataTable")
Dim firstName As New DataColumn("FirstName", _
Type.GetType("System.String"))
dt.Columns.Add(firstName)
Return dt
End Function