📄 dataset1.vb
字号:
Me.Columns.Add(Me.columnaddress)
Me.columnbirth = New DataColumn("birth", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnbirth)
Me.columnbp = New DataColumn("bp", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnbp)
Me.columndemo = New DataColumn("demo", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columndemo)
Me.columnemail = New DataColumn("email", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnemail)
Me.columnid = New DataColumn("id", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnid)
Me.columnmobile = New DataColumn("mobile", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnmobile)
Me.columnname = New DataColumn("name", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnname)
Me.columnpc = New DataColumn("pc", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnpc)
Me.columnphone = New DataColumn("phone", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnphone)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnid}, true))
Me.columnid.AutoIncrement = true
Me.columnid.AllowDBNull = false
Me.columnid.Unique = true
End Sub
Public Function NewdetailRow() As detailRow
Return CType(Me.NewRow,detailRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New detailRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(detailRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.detailRowChangedEvent) Is Nothing) Then
RaiseEvent detailRowChanged(Me, New detailRowChangeEvent(CType(e.Row,detailRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.detailRowChangingEvent) Is Nothing) Then
RaiseEvent detailRowChanging(Me, New detailRowChangeEvent(CType(e.Row,detailRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.detailRowDeletedEvent) Is Nothing) Then
RaiseEvent detailRowDeleted(Me, New detailRowChangeEvent(CType(e.Row,detailRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.detailRowDeletingEvent) Is Nothing) Then
RaiseEvent detailRowDeleting(Me, New detailRowChangeEvent(CType(e.Row,detailRow), e.Action))
End If
End Sub
Public Sub RemovedetailRow(ByVal row As detailRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class detailRow
Inherits DataRow
Private tabledetail As detailDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tabledetail = CType(Me.Table,detailDataTable)
End Sub
Public Property address As String
Get
Try
Return CType(Me(Me.tabledetail.addressColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.addressColumn) = value
End Set
End Property
Public Property birth As Date
Get
Try
Return CType(Me(Me.tabledetail.birthColumn),Date)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.birthColumn) = value
End Set
End Property
Public Property bp As String
Get
Try
Return CType(Me(Me.tabledetail.bpColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.bpColumn) = value
End Set
End Property
Public Property demo As String
Get
Try
Return CType(Me(Me.tabledetail.demoColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.demoColumn) = value
End Set
End Property
Public Property email As String
Get
Try
Return CType(Me(Me.tabledetail.emailColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.emailColumn) = value
End Set
End Property
Public Property id As Integer
Get
Return CType(Me(Me.tabledetail.idColumn),Integer)
End Get
Set
Me(Me.tabledetail.idColumn) = value
End Set
End Property
Public Property mobile As String
Get
Try
Return CType(Me(Me.tabledetail.mobileColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.mobileColumn) = value
End Set
End Property
Public Property name As String
Get
Try
Return CType(Me(Me.tabledetail.nameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.nameColumn) = value
End Set
End Property
Public Property pc As String
Get
Try
Return CType(Me(Me.tabledetail.pcColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.pcColumn) = value
End Set
End Property
Public Property phone As String
Get
Try
Return CType(Me(Me.tabledetail.phoneColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tabledetail.phoneColumn) = value
End Set
End Property
Public Function IsaddressNull() As Boolean
Return Me.IsNull(Me.tabledetail.addressColumn)
End Function
Public Sub SetaddressNull()
Me(Me.tabledetail.addressColumn) = System.Convert.DBNull
End Sub
Public Function IsbirthNull() As Boolean
Return Me.IsNull(Me.tabledetail.birthColumn)
End Function
Public Sub SetbirthNull()
Me(Me.tabledetail.birthColumn) = System.Convert.DBNull
End Sub
Public Function IsbpNull() As Boolean
Return Me.IsNull(Me.tabledetail.bpColumn)
End Function
Public Sub SetbpNull()
Me(Me.tabledetail.bpColumn) = System.Convert.DBNull
End Sub
Public Function IsdemoNull() As Boolean
Return Me.IsNull(Me.tabledetail.demoColumn)
End Function
Public Sub SetdemoNull()
Me(Me.tabledetail.demoColumn) = System.Convert.DBNull
End Sub
Public Function IsemailNull() As Boolean
Return Me.IsNull(Me.tabledetail.emailColumn)
End Function
Public Sub SetemailNull()
Me(Me.tabledetail.emailColumn) = System.Convert.DBNull
End Sub
Public Function IsmobileNull() As Boolean
Return Me.IsNull(Me.tabledetail.mobileColumn)
End Function
Public Sub SetmobileNull()
Me(Me.tabledetail.mobileColumn) = System.Convert.DBNull
End Sub
Public Function IsnameNull() As Boolean
Return Me.IsNull(Me.tabledetail.nameColumn)
End Function
Public Sub SetnameNull()
Me(Me.tabledetail.nameColumn) = System.Convert.DBNull
End Sub
Public Function IspcNull() As Boolean
Return Me.IsNull(Me.tabledetail.pcColumn)
End Function
Public Sub SetpcNull()
Me(Me.tabledetail.pcColumn) = System.Convert.DBNull
End Sub
Public Function IsphoneNull() As Boolean
Return Me.IsNull(Me.tabledetail.phoneColumn)
End Function
Public Sub SetphoneNull()
Me(Me.tabledetail.phoneColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class detailRowChangeEvent
Inherits EventArgs
Private eventRow As detailRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As detailRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As detailRow
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 + -