📄 dataset1.vb
字号:
End Function
Public Sub SetpassNull()
Me(Me.tableyonghu.passColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class yonghuRowChangeEvent
Inherits EventArgs
Private eventRow As yonghuRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As yonghuRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As yonghuRow
Get
Return Me.eventRow
End Get
End Property
Public ReadOnly Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class _123DataTable
Inherits DataTable
Implements System.Collections.IEnumerable
Private column班级 As DataColumn
Private column年龄 As DataColumn
Private column姓名 As DataColumn
Private column学号 As DataColumn
Private column职务 As DataColumn
Friend Sub New()
MyBase.New("123")
Me.InitClass
End Sub
Friend Sub New(ByVal table As DataTable)
MyBase.New(table.TableName)
If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then
Me.CaseSensitive = table.CaseSensitive
End If
If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then
Me.Locale = table.Locale
End If
If (table.Namespace <> table.DataSet.Namespace) Then
Me.Namespace = table.Namespace
End If
Me.Prefix = table.Prefix
Me.MinimumCapacity = table.MinimumCapacity
Me.DisplayExpression = table.DisplayExpression
End Sub
<System.ComponentModel.Browsable(false)> _
Public ReadOnly Property Count As Integer
Get
Return Me.Rows.Count
End Get
End Property
Friend ReadOnly Property 班级Column As DataColumn
Get
Return Me.column班级
End Get
End Property
Friend ReadOnly Property 年龄Column As DataColumn
Get
Return Me.column年龄
End Get
End Property
Friend ReadOnly Property 姓名Column As DataColumn
Get
Return Me.column姓名
End Get
End Property
Friend ReadOnly Property 学号Column As DataColumn
Get
Return Me.column学号
End Get
End Property
Friend ReadOnly Property 职务Column As DataColumn
Get
Return Me.column职务
End Get
End Property
Public Default ReadOnly Property Item(ByVal index As Integer) As _123Row
Get
Return CType(Me.Rows(index),_123Row)
End Get
End Property
Public Event _123RowChanged As _123RowChangeEventHandler
Public Event _123RowChanging As _123RowChangeEventHandler
Public Event _123RowDeleted As _123RowChangeEventHandler
Public Event _123RowDeleting As _123RowChangeEventHandler
Public Overloads Sub Add_123Row(ByVal row As _123Row)
Me.Rows.Add(row)
End Sub
Public Overloads Function Add_123Row(ByVal 班级 As String, ByVal 年龄 As String, ByVal 姓名 As String, ByVal 学号 As String, ByVal 职务 As String) As _123Row
Dim row_123Row As _123Row = CType(Me.NewRow,_123Row)
row_123Row.ItemArray = New Object() {班级, 年龄, 姓名, 学号, 职务}
Me.Rows.Add(row_123Row)
Return row_123Row
End Function
Public Function FindBy学号(ByVal 学号 As String) As _123Row
Return CType(Me.Rows.Find(New Object() {学号}),_123Row)
End Function
Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return Me.Rows.GetEnumerator
End Function
Public Overrides Function Clone() As DataTable
Dim cln As _123DataTable = CType(MyBase.Clone,_123DataTable)
cln.InitVars
Return cln
End Function
Protected Overrides Function CreateInstance() As DataTable
Return New _123DataTable
End Function
Friend Sub InitVars()
Me.column班级 = Me.Columns("班级")
Me.column年龄 = Me.Columns("年龄")
Me.column姓名 = Me.Columns("姓名")
Me.column学号 = Me.Columns("学号")
Me.column职务 = Me.Columns("职务")
End Sub
Private Sub InitClass()
Me.column班级 = New DataColumn("班级", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column班级)
Me.column年龄 = New DataColumn("年龄", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column年龄)
Me.column姓名 = New DataColumn("姓名", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column姓名)
Me.column学号 = New DataColumn("学号", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column学号)
Me.column职务 = New DataColumn("职务", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.column职务)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.column学号}, true))
Me.column学号.AllowDBNull = false
Me.column学号.Unique = true
End Sub
Public Function New_123Row() As _123Row
Return CType(Me.NewRow,_123Row)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New _123Row(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(_123Row)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me._123RowChangedEvent) Is Nothing) Then
RaiseEvent _123RowChanged(Me, New _123RowChangeEvent(CType(e.Row,_123Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me._123RowChangingEvent) Is Nothing) Then
RaiseEvent _123RowChanging(Me, New _123RowChangeEvent(CType(e.Row,_123Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me._123RowDeletedEvent) Is Nothing) Then
RaiseEvent _123RowDeleted(Me, New _123RowChangeEvent(CType(e.Row,_123Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me._123RowDeletingEvent) Is Nothing) Then
RaiseEvent _123RowDeleting(Me, New _123RowChangeEvent(CType(e.Row,_123Row), e.Action))
End If
End Sub
Public Sub Remove_123Row(ByVal row As _123Row)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class _123Row
Inherits DataRow
Private table_123 As _123DataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.table_123 = CType(Me.Table,_123DataTable)
End Sub
Public Property 班级 As String
Get
Try
Return CType(Me(Me.table_123.班级Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_123.班级Column) = value
End Set
End Property
Public Property 年龄 As String
Get
Try
Return CType(Me(Me.table_123.年龄Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_123.年龄Column) = value
End Set
End Property
Public Property 姓名 As String
Get
Try
Return CType(Me(Me.table_123.姓名Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_123.姓名Column) = value
End Set
End Property
Public Property 学号 As String
Get
Return CType(Me(Me.table_123.学号Column),String)
End Get
Set
Me(Me.table_123.学号Column) = value
End Set
End Property
Public Property 职务 As String
Get
Try
Return CType(Me(Me.table_123.职务Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_123.职务Column) = value
End Set
End Property
Public Function Is班级Null() As Boolean
Return Me.IsNull(Me.table_123.班级Column)
End Function
Public Sub Set班级Null()
Me(Me.table_123.班级Column) = System.Convert.DBNull
End Sub
Public Function Is年龄Null() As Boolean
Return Me.IsNull(Me.table_123.年龄Column)
End Function
Public Sub Set年龄Null()
Me(Me.table_123.年龄Column) = System.Convert.DBNull
End Sub
Public Function Is姓名Null() As Boolean
Return Me.IsNull(Me.table_123.姓名Column)
End Function
Public Sub Set姓名Null()
Me(Me.table_123.姓名Column) = System.Convert.DBNull
End Sub
Public Function Is职务Null() As Boolean
Return Me.IsNull(Me.table_123.职务Column)
End Function
Public Sub Set职务Null()
Me(Me.table_123.职务Column) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class _123RowChangeEvent
Inherits EventArgs
Private eventRow As _123Row
Private eventAction As DataRowAction
Public Sub New(ByVal row As _123Row, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As _123Row
Get
Return Me.eventRow
End Get
End Property
Public ReadOnly Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -