本文整理汇总了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