本文整理汇总了VB.NET中System.Data.DataRowVersion枚举的典型用法代码示例。如果您正苦于以下问题:VB.NET DataRowVersion枚举的具体用法?VB.NET DataRowVersion怎么用?VB.NET DataRowVersion使用的例子?那么恭喜您, 这里精选的枚举代码示例或许可以为您提供帮助。
在下文中一共展示了DataRowVersion枚举的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: CheckVersionBeforeAccept
Private Sub CheckVersionBeforeAccept()
'Run a function to create a DataTable with one column.
Dim dataTable As DataTable = MakeTable()
Dim dataRow As DataRow = dataTable.NewRow()
dataRow("FirstName") = "Marcy"
dataTable.Rows.Add(dataRow)
dataRow.BeginEdit()
' Edit data but keep the same value.
dataRow(0) = "Marcy"
' Uncomment the following line to add a new value.
' dataRow(0) = "Richard"
Console.WriteLine(String.Format("FirstName {0}", dataRow(0)))
' Compare the proposed version with the current.
If dataRow.HasVersion(DataRowVersion.Proposed) Then
If dataRow(0, DataRowVersion.Current) Is dataRow(0, DataRowVersion.Proposed) Then
Console.WriteLine("The original and the proposed are the same.")
dataRow.CancelEdit()
Else
dataRow.AcceptChanges()
Console.WriteLine("The original and the proposed are different.")
End If
End If
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
开发者ID:VB.NET开发者,项目名称:System.Data,代码行数:35,代码来源:DataRowVersion
注:本文中的System.Data.DataRowVersion枚举示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论