📄 dataset1.vb
字号:
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 IC卡号Column As DataColumn
Get
Return Me.columnIC卡号
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
Friend ReadOnly Property 刷卡时间Column As DataColumn
Get
Return Me.column刷卡时间
End Get
End Property
Public Default ReadOnly Property Item(ByVal index As Integer) As 刷卡记录Row
Get
Return CType(Me.Rows(index),刷卡记录Row)
End Get
End Property
Public Event 刷卡记录RowChanged As 刷卡记录RowChangeEventHandler
Public Event 刷卡记录RowChanging As 刷卡记录RowChangeEventHandler
Public Event 刷卡记录RowDeleted As 刷卡记录RowChangeEventHandler
Public Event 刷卡记录RowDeleting As 刷卡记录RowChangeEventHandler
Public Overloads Sub Add刷卡记录Row(ByVal row As 刷卡记录Row)
Me.Rows.Add(row)
End Sub
Public Overloads Function Add刷卡记录Row(ByVal IC卡号 As String, ByVal 姓名 As String, ByVal 班级 As String, ByVal 学号 As String, ByVal 专业 As String, ByVal 刷卡日期 As String, ByVal 刷卡时间 As String) As 刷卡记录Row
Dim row刷卡记录Row As 刷卡记录Row = CType(Me.NewRow,刷卡记录Row)
row刷卡记录Row.ItemArray = New Object() {IC卡号, 姓名, 班级, 学号, 专业, 刷卡日期, 刷卡时间}
Me.Rows.Add(row刷卡记录Row)
Return row刷卡记录Row
End Function
Public Function FindByIC卡号(ByVal IC卡号 As String) As 刷卡记录Row
Return CType(Me.Rows.Find(New Object() {IC卡号}),刷卡记录Row)
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 刷卡记录DataTable = CType(MyBase.Clone,刷卡记录DataTable)
cln.InitVars
Return cln
End Function
Protected Overrides Function CreateInstance() As DataTable
Return New 刷卡记录DataTable
End Function
Friend Sub InitVars()
Me.columnIC卡号 = Me.Columns("IC卡号")
Me.column姓名 = Me.Columns("姓名")
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.columnIC卡号 = New DataColumn("IC卡号", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnIC卡号)
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.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.columnIC卡号}, true))
Me.columnIC卡号.AllowDBNull = false
Me.columnIC卡号.Unique = true
End Sub
Public Function New刷卡记录Row() As 刷卡记录Row
Return CType(Me.NewRow,刷卡记录Row)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New 刷卡记录Row(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(刷卡记录Row)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.刷卡记录RowChangedEvent) Is Nothing) Then
RaiseEvent 刷卡记录RowChanged(Me, New 刷卡记录RowChangeEvent(CType(e.Row,刷卡记录Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.刷卡记录RowChangingEvent) Is Nothing) Then
RaiseEvent 刷卡记录RowChanging(Me, New 刷卡记录RowChangeEvent(CType(e.Row,刷卡记录Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.刷卡记录RowDeletedEvent) Is Nothing) Then
RaiseEvent 刷卡记录RowDeleted(Me, New 刷卡记录RowChangeEvent(CType(e.Row,刷卡记录Row), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.刷卡记录RowDeletingEvent) Is Nothing) Then
RaiseEvent 刷卡记录RowDeleting(Me, New 刷卡记录RowChangeEvent(CType(e.Row,刷卡记录Row), e.Action))
End If
End Sub
Public Sub Remove刷卡记录Row(ByVal row As 刷卡记录Row)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class 刷卡记录Row
Inherits DataRow
Private table刷卡记录 As 刷卡记录DataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.table刷卡记录 = CType(Me.Table,刷卡记录DataTable)
End Sub
Public Property IC卡号 As String
Get
Return CType(Me(Me.table刷卡记录.IC卡号Column),String)
End Get
Set
Me(Me.table刷卡记录.IC卡号Column) = value
End Set
End Property
Public Property 姓名 As String
Get
Try
Return CType(Me(Me.table刷卡记录.姓名Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table刷卡记录.姓名Column) = value
End Set
End Property
Public Property 班级 As String
Get
Try
Return CType(Me(Me.table刷卡记录.班级Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table刷卡记录.班级Column) = value
End Set
End Property
Public Property 学号 As String
Get
Try
Return CType(Me(Me.table刷卡记录.学号Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table刷卡记录.学号Column) = value
End Set
End Property
Public Property 专业 As String
Get
Try
Return CType(Me(Me.table刷卡记录.专业Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table刷卡记录.专业Column) = value
End Set
End Property
Public Property 刷卡日期 As String
Get
Try
Return CType(Me(Me.table刷卡记录.刷卡日期Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table刷卡记录.刷卡日期Column) = value
End Set
End Property
Public Property 刷卡时间 As String
Get
Try
Return CType(Me(Me.table刷卡记录.刷卡时间Column),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table刷卡记录.刷卡时间Column) = value
End Set
End Property
Public Function Is姓名Null() As Boolean
Return Me.IsNull(Me.table刷卡记录.姓名Column)
End Function
Public Sub Set姓名Null()
Me(Me.table刷卡记录.姓名Column) = System.Convert.DBNull
End Sub
Public Function Is班级Null() As Boolean
Return Me.IsNull(Me.table刷卡记录.班级Column)
End Function
Public Sub Set班级Null()
Me(Me.table刷卡记录.班级Column) = System.Convert.DBNull
End Sub
Public Function Is学号Null() As Boolean
Return Me.IsNull(Me.table刷卡记录.学号Column)
End Function
Public Sub Set学号Null()
Me(Me.table刷卡记录.学号Column) = System.Convert.DBNull
End Sub
Public Function Is专业Null() As Boolean
Return Me.IsNull(Me.table刷卡记录.专业Column)
End Function
Public Sub Set专业Null()
Me(Me.table刷卡记录.专业Column) = System.Convert.DBNull
End Sub
Public Function Is刷卡日期Null() As Boolean
Return Me.IsNull(Me.table刷卡记录.刷卡日期Column)
End Function
Public Sub Set刷卡日期Null()
Me(Me.table刷卡记录.刷卡日期Column) = System.Convert.DBNull
End Sub
Public Function Is刷卡时间Null() As Boolean
Return Me.IsNull(Me.table刷卡记录.刷卡时间Column)
End Function
Public Sub Set刷卡时间Null()
Me(Me.table刷卡记录.刷卡时间Column) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class 刷卡记录RowChangeEvent
Inherits EventArgs
Private eventRow As 刷卡记录Row
Private eventAction As DataRowAction
Public Sub New(ByVal row As 刷卡记录Row, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As 刷卡记录Row
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 + -