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

📄 users.frm

📁 一个简单的VB开发环境的学生管理系统.请各位大虾们多多指教
💻 FRM
📖 第 1 页 / 共 4 页
字号:
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   15
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C000C0&
         Height          =   420
         ItemData        =   "users.frx":2DF8
         Left            =   -72720
         List            =   "users.frx":2E02
         TabIndex        =   1
         Text            =   "用户"
         Top             =   2880
         Width           =   2655
      End
      Begin VB.Frame Frame7 
         Height          =   2895
         Left            =   -74880
         TabIndex        =   40
         Top             =   720
         Width           =   5055
         Begin VB.Frame Frame9 
            Height          =   135
            Left            =   120
            TabIndex        =   46
            Top             =   1800
            Width           =   4935
         End
         Begin VB.Frame Frame8 
            Height          =   135
            Left            =   120
            TabIndex        =   45
            Top             =   840
            Width           =   4935
         End
         Begin VB.Label Label4 
            BackStyle       =   0  'Transparent
            Caption         =   "权  限:"
            BeginProperty Font 
               Name            =   "楷体_GB2312"
               Size            =   15
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C000C0&
            Height          =   375
            Left            =   360
            TabIndex        =   44
            Top             =   2280
            Width           =   1815
         End
         Begin VB.Label Label3 
            BackStyle       =   0  'Transparent
            Caption         =   "确认密码:"
            BeginProperty Font 
               Name            =   "楷体_GB2312"
               Size            =   18
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C00000&
            Height          =   735
            Left            =   6240
            TabIndex        =   43
            Top             =   720
            Width           =   2055
         End
         Begin VB.Label Label2 
            BackStyle       =   0  'Transparent
            Caption         =   "密  码:"
            BeginProperty Font 
               Name            =   "楷体_GB2312"
               Size            =   15
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C000C0&
            Height          =   495
            Left            =   360
            TabIndex        =   42
            Top             =   1320
            Width           =   1455
         End
         Begin VB.Label Label1 
            BackStyle       =   0  'Transparent
            Caption         =   "用户名:"
            BeginProperty Font 
               Name            =   "楷体_GB2312"
               Size            =   15
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C000C0&
            Height          =   495
            Left            =   480
            TabIndex        =   41
            Top             =   240
            Width           =   1455
         End
      End
   End
End
Attribute VB_Name = "adduse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public rs As ADODB.Recordset
Private Sub adduser_Click()
Dim r As String
On Error Resume Next
     If Trim(txtuser.Text) = "" Or LenB(txtuser.Text) <= 4 Then
        MsgBox "对不起,您的用户名不能为空或长度小于4位,请从新输入 ! ", vbExclamation, "提示信息"
            txtuser.Text = "": txtuser.SetFocus
            Exit Sub
    End If
        If Trim(txtpasswords1.Text) = "" Or LenB(txtpasswords1.Text) <= 8 Then
            MsgBox "对不起,您的密码为空或长度小于8位,请从新输入 !        ", vbExclamation, "提示信息"
                    txtpasswords1 = "": txtpasswords1.SetFocus
                        Exit Sub
        End If
                    If Trim(Cbquanxian.Text) = "" Then
                            MsgBox "对不起,您的权限设置不能为空,请从新输入 ! ", vbExclamation, "提示信息"
                        Exit Sub
                        End If
            Adodc1.CommandType = adCmdText
                Adodc1.RecordSource = "select  *  from 用户表"
            Adodc1.Refresh
                    Set rs = Adodc1.Recordset
                With rs
            Do While Not .EOF
                If Trim(.Fields("用户名")) <> Trim(txtuser.Text) Then
                    .MoveNext
                    Else
                        MsgBox "你输入的用户名已存在,请从新输入!", vbOKCancel + vbExclamation
                                txtuser.Text = "": txtuser.SetFocus
                    Exit Sub
                End If
            Loop
                    .AddNew
                        .Fields("用户名") = Trim(txtuser.Text)
                        .Fields("密码") = Trim(txtpasswords1.Text)
                        .Fields("权限") = Trim(Cbquanxian)
                        .Update
                      Adodc1.Refresh:   DataGrid1.Refresh
                r = MsgBox("添加用户成功,是否继续操作?", vbOKCancel + vbExclamation, "提示信息")
                        If r = vbOK Then
                                txtuser.Text = "": txtpasswords1 = ""
                                            Exit Sub
                        Else
                                Unload Me: MDIFrm.Show
                        End If

        End With
        End Sub

Private Sub canceluser_Click()
Unload Me
MDIFrm.Show
End Sub

Private Sub Command1_Click()
On Error Resume Next
If Check1.Value = 1 And Check2.Value = 0 Then
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select *from 用户表 "
Adodc2.Refresh
     Set rs = Adodc2.Recordset
     With rs
     Do While Not .EOF
     If Trim(.Fields("用户名")) = Trim(txtuser2) Then
        DataGrid1.Refresh: Exit Sub
     Else: .MoveNext
     End If
     Loop
     MsgBox "没有你要删除的用户,请从新输入!"
        txtuser2 = "": txtuser2.SetFocus: Exit Sub
    End With
End If
If Check1.Value = 0 And Check2.Value = 1 Then
               Adodc2.CommandType = adCmdText
              Adodc2.RecordSource = "select * from 用户表  where 用户='" & txtquanxian & "'"
                     DataGrid2.Refresh
            Set rs = Adodc2.Recordset
         With rs
         Do While Not .EOF
             If Trim(.Fields("权限")) = Trim(txtquanxian) Then
               DataGrid1.Refresh: Exit Sub
              Else: .MoveNext
              End If
              Loop
              MsgBox "没有查询到你要的结果,请从新输入!"
                    txtquanxian = "": txtquanxian.SetFocus: Exit Sub
                End With
End If
    If Check2.Value = 1 And Check1.Value = 1 Then
                            Adodc2.CommandType = adCmdText
                Adodc2.RecordSource = "select * from 用户表 "
                                          Adodc2.Refresh
                   With rs
         Do While Not .EOF
             If Trim(.Fields("权限")) = Trim(txtquanxian) And Trim(.Fields("用户名")) = Trim(txtuser1) Then
           DataGrid1.Refresh: Exit Sub
              Else: .MoveNext
              End If
              Loop
              MsgBox "没有查询到你要的结果,请从新输入!"
                    txtquanxian = "": txtquanxian.SetFocus: Exit Sub
                End With
End If
End Sub

Private Sub Label16_Click()
Unload Me
MDIFrm.Show
End Sub


Private Sub Label17_Click()
Unload Me
MDIFrm.Show
End Sub

Private Sub labelcancel_Click()
Unload Me
MDIFrm.Show
End Sub

Private Sub Labeldel_Click()
Dim r As String
On Error Resume Next
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select * from 用户表 where 用户名='" & txtuser1 & "'"
Adodc2.Refresh
Set rs = Adodc2.Recordset
              Do While Not rs.EOF
                   If Trim(rs.Fields("权限")) = "管理员" Then
                          MsgBox "不能删除系统管理员!": Exit Sub
                    ElseIf Trim(rs.Fields("权限")) = "用户" Then
                          rs.Delete
                       Adodc2.Refresh
                      DataGrid1.Refresh
                        MsgBox "删除用户成功!", vbExclamation, "提示信息"
                        DataGrid1.Refresh
                   r = MsgBox("是否继续进行删除操作", vbOKCancel + vbExclamation, "提示信息")
                  If r = vbOK Then
                  txtquanxian = "": txtuser2.SetFocus: Adodc2.Refresh: DataGrid1.Refresh: Exit Sub
                    Else
                    Unload Me
                    MDIFrm.Show
                    Exit Sub
                    End If
                     Else
                         rs.MoveNext
                End If
            Loop
            MsgBox "没有要删除的用户,请输入要删除的用户!"
            txtuser1 = "": txtuser1.SetFocus: Exit Sub
           
           End Sub


Private Sub Labelmod_Click()
On Error Resume Next
Dim sql As String
                           Adodc3.CommandType = adCmdText
                            Adodc3.RecordSource = "select *from 用户表 "
                          Adodc3.Refresh
                          Set rs = Adodc3.Recordset
                          xuanze.Refresh
                      
          If options = True Then
                           If Trim(txtnewwords.Text) = "" Or LenB(txtnewwords.Text) <= 8 Then
                  MsgBox "对不起,您的新密码为空或长度小于8位,请从新输入 !        ", vbExclamation, "提示信息"
                           txtnewwords = "": txtnewwords1 = "": txtoldword = "": txtoldword.SetFocus
                  Exit Sub
                  End If
                     If Trim(txtnewwords) <> Trim(txtnewwords1) Then
                          MsgBox "两次密码输入不一致,请从新输入!"
                              txtnewwords = "": txtnewwords1.SetFocus: Exit Sub
                    End If
                 If Trim(txtoldword.Text) = "" Then
                    MsgBox "旧密码不能为空,请输入原密码!"
                   txtoldword.SetFocus
                   Exit Sub
                   End If
                 With rs
                 Do While Not .EOF
                 If Trim(.Fields("用户名")) = Trim(loginname) Then
                      .Fields("密码") = Trim(txtnewwords)
                              Adodc3.Recordset.Update
                                 Adodc3.Refresh
                             MsgBox "更改当前用户密码成功!"
                             txtnewwords = "": txtnewwords1 = "": txtoldword = "": txtoldword.SetFocus
                           Exit Sub
                   Else: .MoveNext
                   End If
                   Loop
                   End With
     
        Else
            
                        If Trim(txtuser3.Text) = "" Then
                 MsgBox "对不起,您的用户名不能为空位,请从新输入 ! ", vbExclamation, "提示信息"
                  txtuser3.Text = "": txtuser3.SetFocus
                 Exit Sub
                     End If
                If Trim(txtpassword3.Text) = "" Then
                MsgBox "旧密码不能为空!": txtpassword3.SetFocus: Exit Sub
                End If
                If Trim(txtnewword) = "" Or Trim(txtnewword1) = "" Then
                MsgBox "新密码不能为空,请从新输入!": txtnewwords.SetFocus: Exit Sub
                 End If
                If Trim(txtnewword) <> Trim(txtnewword1) Then
                          MsgBox "两次密码输入不一致,请从新输入!"
                              txtnewwords = "": txtnewwords1.SetFocus: Exit Sub
                    End If
               Adodc3.CommandType = adCmdText
                            Adodc3.RecordSource = "select *from 用户表 "
                          Adodc3.Refresh
                          Set rs = Adodc3.Recordset
           With rs
           Do While Not .EOF
          If Trim(.Fields("用户名")) = Trim(txtuser3) Then
          .Fields("密码") = Trim(txtnewword)
          .Update
          DataGrid2.Refresh
          sql = MsgBox("更改用户密码成功,是否更改其他用户的密码", vbOKCancel + vbExclamation, "提示信息")
          If sql = vbOK Then
             txtuser3 = "": txtnewword1 = "": txtpassword3 = "": txtnewword = "": txtuser3.SetFocus
                     Exit Sub
                End If
        Else: .MoveNext
      End If
      Loop
      End With
        End If
        MsgBox "没有你要修改的用户"
        
              End Sub




⌨️ 快捷键说明

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