本文整理汇总了VB.NET中System.Data.DataSet.OnRemoveTable方法的典型用法代码示例。如果您正苦于以下问题:VB.NET DataSet.OnRemoveTable方法的具体用法?VB.NET DataSet.OnRemoveTable怎么用?VB.NET DataSet.OnRemoveTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataSet
的用法示例。
在下文中一共展示了DataSet.OnRemoveTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: DerivedDataSet
Public Shared Sub DemonstrateOnRemoveTable()
Dim dataSet As DerivedDataSet = CreateDataSet()
If dataSet.Tables.Count > 0 Then dataSet.Tables.RemoveAt(0)
End Sub
Public Class DerivedDataSet
Inherits DataSet
Protected Overrides Sub OnRemoveTable(table As DataTable)
Console.WriteLine( _
"The '{0}' DataTable has been removed from the DataSet", _
table.TableName)
End Sub
End Class
Public Shared Function CreateDataSet() As DerivedDataSet
' Create a DataSet with one table containing two columns.
Dim derived As New DerivedDataSet()
' Add table to DataSet.
Dim table As DataTable = derived.Tables.Add("Items")
' Add two columns.
Dim column As DataColumn = table.Columns.Add("id", _
Type.GetType("System.Int32"))
column.AutoIncrement = True
table.Columns.Add("item", Type.GetType("System.Int32"))
' Set primary key.
table.PrimaryKey = New DataColumn() {table.Columns("id")}
return derived
End Function