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

📄 操作类_ett_tb_loginuser.vb

📁 CSDN V3.0 使用VB。Net开发 可以使用该助手访问CSDN
💻 VB
字号:
Imports System.Data.OleDb

Public Class Da_TB_LoginUser
    Inherits DbBase

    Public Function Del(ByVal entity As entity_TB_LoginUser) As Boolean
        Dim StrSql As String = "Delete From TB_LoginUser Where [UserName] =?"
        Dim alParas As New ArrayList
        Dim P As OleDb.OleDbParameter
        P = New OleDb.OleDbParameter("@UserName", entity_TB_LoginUser.COL_TYPE_USERNAME, entity_TB_LoginUser.COL_LEN_USERNAME, "@UserName")
        P.Value = entity.UserName
        alParas.Add(P)
        Return Me.ExecuteBool(StrSql, alParas, CommandType.Text)
    End Function

    Public Function SetDef(ByVal entity As entity_TB_LoginUser) As Boolean

        '先把所有的用户的默认属性去掉。
        Dim StrSql As String = "UPDATE TB_LoginUser SET [Default] = ?  "
        Dim P As OleDb.OleDbParameter
        Dim alParas As New ArrayList

        P = New OleDb.OleDbParameter("@Default", entity_TB_LoginUser.COL_TYPE_DEFAULT, entity_TB_LoginUser.COL_LEN_DEFAULT, "@Default")
        P.Value = False
        alParas.Add(P)
        Me.ExecuteBool(StrSql, alParas, CommandType.Text)


        '设置当前
        alParas.Clear()
        StrSql = "UPDATE TB_LoginUser SET [Default] = ?  Where [UserName] = ?"
        '以下是字段
        P = New OleDb.OleDbParameter("@Default", entity_TB_LoginUser.COL_TYPE_DEFAULT, entity_TB_LoginUser.COL_LEN_DEFAULT, "@Default")
        P.Value = entity.Default
        alParas.Add(P)
        '以下是条件
        P = New OleDb.OleDbParameter("@UserName", entity_TB_LoginUser.COL_TYPE_USERNAME, entity_TB_LoginUser.COL_LEN_USERNAME, "@UserName")
        P.Value = entity.UserName
        alParas.Add(P)
        Return Me.ExecuteBool(StrSql, alParas, CommandType.Text)
    End Function

    Public Function Update(ByVal entity As entity_TB_LoginUser) As Int32
        Dim StrSql As String = "UPDATE TB_LoginUser SET ABCDEF = ? ,[Default] = ? ,Pass = ? ,QWERTOP = ? ,Userid = ?  Where [UserName] = ?"
        '以下是字段
        Dim alParas As New ArrayList
        Dim P As OleDb.OleDbParameter
        P = New OleDb.OleDbParameter("@ABCDEF", entity_TB_LoginUser.COL_TYPE_ABCDEF, entity_TB_LoginUser.COL_LEN_ABCDEF, "@ABCDEF")
        P.Value = entity.ABCDEF
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@Default", entity_TB_LoginUser.COL_TYPE_DEFAULT, entity_TB_LoginUser.COL_LEN_DEFAULT, "@Default")
        P.Value = entity.Default
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@Pass", entity_TB_LoginUser.COL_TYPE_PASS, entity_TB_LoginUser.COL_LEN_PASS, "@Pass")
        P.Value = entity.Pass
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@QWERTOP", entity_TB_LoginUser.COL_TYPE_QWERTOP, entity_TB_LoginUser.COL_LEN_QWERTOP, "@QWERTOP")
        P.Value = entity.QWERTOP
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@Userid", entity_TB_LoginUser.COL_TYPE_USERID, entity_TB_LoginUser.COL_LEN_USERID, "@Userid")
        P.Value = entity.Userid
        alParas.Add(P)
        '以下是条件
        P = New OleDb.OleDbParameter("@UserName", entity_TB_LoginUser.COL_TYPE_USERNAME, entity_TB_LoginUser.COL_LEN_USERNAME, "@UserName")
        P.Value = entity.UserName
        alParas.Add(P)
        Return Me.ExecuteNonQuery(StrSql, alParas, CommandType.Text)
    End Function
    Public Function addNew(ByVal entity As entity_TB_LoginUser) As Boolean
        Dim StrSql As String = "INSERT INTO TB_LoginUser ( ABCDEF ,[Default] ,Pass ,QWERTOP ,Userid ,[UserName] ) VALUES (? ,? ,? ,? ,? ,? )"
        Dim alParas As New ArrayList
        Dim P As OleDb.OleDbParameter
        P = New OleDb.OleDbParameter("@ABCDEF", entity_TB_LoginUser.COL_TYPE_ABCDEF, entity_TB_LoginUser.COL_LEN_ABCDEF, "@ABCDEF")
        P.Value = entity.ABCDEF
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@Default", entity_TB_LoginUser.COL_TYPE_DEFAULT, entity_TB_LoginUser.COL_LEN_DEFAULT, "@Default")
        P.Value = entity.Default
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@Pass", entity_TB_LoginUser.COL_TYPE_PASS, entity_TB_LoginUser.COL_LEN_PASS, "@Pass")
        P.Value = entity.Pass
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@QWERTOP", entity_TB_LoginUser.COL_TYPE_QWERTOP, entity_TB_LoginUser.COL_LEN_QWERTOP, "@QWERTOP")
        P.Value = entity.QWERTOP
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@Userid", entity_TB_LoginUser.COL_TYPE_USERID, entity_TB_LoginUser.COL_LEN_USERID, "@Userid")
        P.Value = entity.Userid
        alParas.Add(P)
        P = New OleDb.OleDbParameter("@UserName", entity_TB_LoginUser.COL_TYPE_USERNAME, entity_TB_LoginUser.COL_LEN_USERNAME, "@UserName")
        P.Value = entity.UserName
        alParas.Add(P)
        Return Me.ExecuteBool(StrSql, alParas, CommandType.Text)
    End Function

    Public Function GetList()  As ArrayList
        Dim StrSql As String = "Select ABCDEF,[Default],Pass,QWERTOP,Userid,[UserName] FROM TB_LoginUser"
        Dim dr As OleDbDataReader = Me.CreateOleDbDataReader(StrSql)
        Dim Myentity As entity_TB_LoginUser
        Dim ResultList As System.Collections.ArrayList
        ResultList = New System.Collections.ArrayList
        Dim FieldIndexs(5) As Integer
        Dim IndexInited As Boolean = False
        While dr.Read
            If Not IndexInited Then
                 FieldIndexs(0) = dr.GetOrdinal("ABCDEF")
                 FieldIndexs(1) = dr.GetOrdinal("Default")
                 FieldIndexs(2) = dr.GetOrdinal("Pass")
                 FieldIndexs(3) = dr.GetOrdinal("QWERTOP")
                 FieldIndexs(4) = dr.GetOrdinal("Userid")
                 FieldIndexs(5) = dr.GetOrdinal("UserName")
                 IndexInited = True
            End If
            Myentity = New entity_TB_LoginUser
            If   dr.IsDBNull(FieldIndexs(0)) Then
                Myentity.ABCDEF = "" '其他 默认为 null
            Else
                 myentity.ABCDEF = dr.GetString(FieldIndexs(0))
            End If
            If   dr.IsDBNull(FieldIndexs(1)) Then
                Myentity.Default = "" '其他 默认为 null
            Else
                 myentity.Default = dr.GetByte(FieldIndexs(1))
            End If
            If   dr.IsDBNull(FieldIndexs(2)) Then
                Myentity.Pass = "" '其他 默认为 null
            Else
                 myentity.Pass = dr.GetString(FieldIndexs(2))
            End If
            If   dr.IsDBNull(FieldIndexs(3)) Then
                Myentity.QWERTOP = "" '其他 默认为 null
            Else
                 myentity.QWERTOP = dr.GetString(FieldIndexs(3))
            End If
            If   dr.IsDBNull(FieldIndexs(4)) Then
                Myentity.Userid = "" '其他 默认为 null
            Else
                 myentity.Userid = dr.GetString(FieldIndexs(4))
            End If
            If   dr.IsDBNull(FieldIndexs(5)) Then
                Myentity.UserName = "" '其他 默认为 null
            Else
                 myentity.UserName = dr.GetString(FieldIndexs(5))
            End If
        ResultList.Add(Myentity)
        End While
        dr.Close()
        Return ResultList
   End Function
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -