⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dataset1.vb

📁 图书管理系统,可以实现图书的增加,删除,修改,也可以实现用户的增加,删除,修改.
💻 VB
📖 第 1 页 / 共 2 页
字号:
        Public Overloads Function Adduser_infoRow(ByVal emailid As String, ByVal lend As Single, ByVal password As String, ByVal username As String) As user_infoRow
            Dim rowuser_infoRow As user_infoRow = CType(Me.NewRow,user_infoRow)
            rowuser_infoRow.ItemArray = New Object() {emailid, lend, password, Nothing, username}
            Me.Rows.Add(rowuser_infoRow)
            Return rowuser_infoRow
        End Function
        
        Public Function FindByuserid(ByVal userid As Integer) As user_infoRow
            Return CType(Me.Rows.Find(New Object() {userid}),user_infoRow)
        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 user_infoDataTable = CType(MyBase.Clone,user_infoDataTable)
            cln.InitVars
            Return cln
        End Function
        
        Protected Overrides Function CreateInstance() As DataTable
            Return New user_infoDataTable
        End Function
        
        Friend Sub InitVars()
            Me.columnemailid = Me.Columns("emailid")
            Me.columnlend = Me.Columns("lend")
            Me.columnpassword = Me.Columns("password")
            Me.columnuserid = Me.Columns("userid")
            Me.columnusername = Me.Columns("username")
        End Sub
        
        Private Sub InitClass()
            Me.columnemailid = New DataColumn("emailid", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnemailid)
            Me.columnlend = New DataColumn("lend", GetType(System.Single), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnlend)
            Me.columnpassword = New DataColumn("password", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnpassword)
            Me.columnuserid = New DataColumn("userid", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnuserid)
            Me.columnusername = New DataColumn("username", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnusername)
            Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnuserid}, true))
            Me.columnuserid.AutoIncrement = true
            Me.columnuserid.AllowDBNull = false
            Me.columnuserid.Unique = true
        End Sub
        
        Public Function Newuser_infoRow() As user_infoRow
            Return CType(Me.NewRow,user_infoRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New user_infoRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(user_infoRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.user_infoRowChangedEvent) Is Nothing) Then
                RaiseEvent user_infoRowChanged(Me, New user_infoRowChangeEvent(CType(e.Row,user_infoRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.user_infoRowChangingEvent) Is Nothing) Then
                RaiseEvent user_infoRowChanging(Me, New user_infoRowChangeEvent(CType(e.Row,user_infoRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.user_infoRowDeletedEvent) Is Nothing) Then
                RaiseEvent user_infoRowDeleted(Me, New user_infoRowChangeEvent(CType(e.Row,user_infoRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.user_infoRowDeletingEvent) Is Nothing) Then
                RaiseEvent user_infoRowDeleting(Me, New user_infoRowChangeEvent(CType(e.Row,user_infoRow), e.Action))
            End If
        End Sub
        
        Public Sub Removeuser_infoRow(ByVal row As user_infoRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class user_infoRow
        Inherits DataRow
        
        Private tableuser_info As user_infoDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableuser_info = CType(Me.Table,user_infoDataTable)
        End Sub
        
        Public Property emailid As String
            Get
                Try 
                    Return CType(Me(Me.tableuser_info.emailidColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableuser_info.emailidColumn) = value
            End Set
        End Property
        
        Public Property lend As Single
            Get
                Try 
                    Return CType(Me(Me.tableuser_info.lendColumn),Single)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableuser_info.lendColumn) = value
            End Set
        End Property
        
        Public Property password As String
            Get
                Try 
                    Return CType(Me(Me.tableuser_info.passwordColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableuser_info.passwordColumn) = value
            End Set
        End Property
        
        Public Property userid As Integer
            Get
                Return CType(Me(Me.tableuser_info.useridColumn),Integer)
            End Get
            Set
                Me(Me.tableuser_info.useridColumn) = value
            End Set
        End Property
        
        Public Property username As String
            Get
                Try 
                    Return CType(Me(Me.tableuser_info.usernameColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tableuser_info.usernameColumn) = value
            End Set
        End Property
        
        Public Function IsemailidNull() As Boolean
            Return Me.IsNull(Me.tableuser_info.emailidColumn)
        End Function
        
        Public Sub SetemailidNull()
            Me(Me.tableuser_info.emailidColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IslendNull() As Boolean
            Return Me.IsNull(Me.tableuser_info.lendColumn)
        End Function
        
        Public Sub SetlendNull()
            Me(Me.tableuser_info.lendColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IspasswordNull() As Boolean
            Return Me.IsNull(Me.tableuser_info.passwordColumn)
        End Function
        
        Public Sub SetpasswordNull()
            Me(Me.tableuser_info.passwordColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsusernameNull() As Boolean
            Return Me.IsNull(Me.tableuser_info.usernameColumn)
        End Function
        
        Public Sub SetusernameNull()
            Me(Me.tableuser_info.usernameColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class user_infoRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As user_infoRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As user_infoRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As user_infoRow
            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 + -