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

📄 user2.frm

📁 用VB连接ORalce数据库的学生管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmuser2 
   BackColor       =   &H00FFFFC0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "修改用户信息"
   ClientHeight    =   6735
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9180
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6735
   ScaleWidth      =   9180
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFC0&
      Caption         =   "修改用户信息"
      ForeColor       =   &H000000FF&
      Height          =   6135
      Left            =   480
      TabIndex        =   0
      Top             =   120
      Width           =   8295
      Begin VB.Frame Frame5 
         BackColor       =   &H00FFFFC0&
         Caption         =   "新信息"
         Height          =   4335
         Left            =   4320
         TabIndex        =   9
         Top             =   840
         Width           =   3135
         Begin VB.Frame Frame3 
            BackColor       =   &H00FFFFC0&
            Caption         =   "用户类别"
            ForeColor       =   &H000000FF&
            Height          =   1575
            Left            =   360
            TabIndex        =   16
            Top             =   2280
            Width           =   2535
            Begin VB.OptionButton optmang 
               BackColor       =   &H00FFFFC0&
               Caption         =   "管理员"
               BeginProperty Font 
                  Name            =   "楷体_GB2312"
                  Size            =   12
                  Charset         =   134
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ForeColor       =   &H00000000&
               Height          =   495
               Index           =   0
               Left            =   360
               TabIndex        =   18
               Top             =   360
               Width           =   1815
            End
            Begin VB.OptionButton optuser 
               BackColor       =   &H00FFFFC0&
               Caption         =   "普通用户"
               BeginProperty Font 
                  Name            =   "楷体_GB2312"
                  Size            =   12
                  Charset         =   134
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ForeColor       =   &H00000000&
               Height          =   495
               Index           =   2
               Left            =   360
               TabIndex        =   17
               Top             =   960
               Width           =   1815
            End
         End
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            ForeColor       =   &H000000FF&
            Height          =   270
            Index           =   0
            Left            =   1320
            TabIndex        =   12
            TabStop         =   0   'False
            Top             =   480
            Width           =   855
         End
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            ForeColor       =   &H000000FF&
            Height          =   270
            IMEMode         =   3  'DISABLE
            Index           =   1
            Left            =   1320
            PasswordChar    =   "*"
            TabIndex        =   11
            TabStop         =   0   'False
            Top             =   960
            Width           =   855
         End
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            ForeColor       =   &H000000FF&
            Height          =   270
            IMEMode         =   3  'DISABLE
            Index           =   2
            Left            =   1320
            PasswordChar    =   "*"
            TabIndex        =   10
            TabStop         =   0   'False
            Top             =   1440
            Width           =   855
         End
         Begin VB.Label Label2 
            BackColor       =   &H00FFFFC0&
            Caption         =   "用户名:"
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   240
            TabIndex        =   15
            Top             =   480
            Width           =   975
         End
         Begin VB.Label Label1 
            BackColor       =   &H00FFFFC0&
            Caption         =   "密   码:"
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   240
            TabIndex        =   14
            Top             =   960
            Width           =   855
         End
         Begin VB.Label Label3 
            BackColor       =   &H00FFFFC0&
            Caption         =   "确定密码:"
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   240
            TabIndex        =   13
            Top             =   1440
            Width           =   975
         End
      End
      Begin VB.Frame Frame4 
         BackColor       =   &H00FFFFC0&
         Caption         =   "旧信息"
         Height          =   2175
         Left            =   600
         TabIndex        =   4
         Top             =   1560
         Width           =   3015
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            ForeColor       =   &H000000FF&
            Height          =   270
            IMEMode         =   3  'DISABLE
            Index           =   3
            Left            =   1440
            TabIndex        =   19
            TabStop         =   0   'False
            Top             =   480
            Width           =   855
         End
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            ForeColor       =   &H000000FF&
            Height          =   270
            IMEMode         =   3  'DISABLE
            Index           =   5
            Left            =   1440
            PasswordChar    =   "*"
            TabIndex        =   6
            TabStop         =   0   'False
            Top             =   1440
            Width           =   855
         End
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            ForeColor       =   &H000000FF&
            Height          =   270
            IMEMode         =   3  'DISABLE
            Index           =   4
            Left            =   1440
            PasswordChar    =   "*"
            TabIndex        =   5
            TabStop         =   0   'False
            Top             =   960
            Width           =   855
         End
         Begin VB.Label Label4 
            BackColor       =   &H00FFFFC0&
            Caption         =   "确定密码:"
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   360
            TabIndex        =   20
            Top             =   1440
            Width           =   975
         End
         Begin VB.Label Label6 
            BackColor       =   &H00FFFFC0&
            Caption         =   "用户名:"
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   360
            TabIndex        =   8
            Top             =   480
            Width           =   975
         End
         Begin VB.Label Label5 
            BackColor       =   &H00FFFFC0&
            Caption         =   "密   码:"
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   360
            TabIndex        =   7
            Top             =   960
            Width           =   855
         End
      End
      Begin VB.CommandButton Command3 
         Caption         =   "删除"
         Height          =   375
         Left            =   3600
         TabIndex        =   3
         Top             =   5520
         Width           =   1095
      End
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   330
         Left            =   4920
         Top             =   120
         Visible         =   0   'False
         Width           =   1200
         _ExtentX        =   2117
         _ExtentY        =   582
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   ""
         OLEDBString     =   ""
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   "he"
         Password        =   "he"
         RecordSource    =   ""
         Caption         =   "Adodc1"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _Version        =   393216
      End
      Begin VB.CommandButton Command2 
         BackColor       =   &H00FFFF80&
         Caption         =   "返回"
         Height          =   375
         Left            =   5880
         TabIndex        =   2
         Top             =   5520
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "修改"
         Height          =   375
         Left            =   1320
         TabIndex        =   1
         Top             =   5520
         Width           =   1095
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   3720
         Picture         =   "user2.frx":0000
         Top             =   120
         Width           =   480
      End
   End
End
Attribute VB_Name = "frmuser2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sql As String
Private Sub Command1_Click()
If Trim(Text1(3).Text) = "" Then
 MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(3).SetFocus
 Exit Sub
End If
If Trim(Text1(4).Text) = "" Then
 MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(4).SetFocus
 Exit Sub
End If
If Trim(Text1(4).Text) <> Trim(Text1(5).Text) Then
 MsgBox "两次密码不一致!", vbExclamation + vbOKOnly, "警告"
 Text1(5).SetFocus
 Exit Sub
End If
If Trim(Text1(0).Text) = "" Then
 MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(0).SetFocus
 Exit Sub
End If
If Trim(Text1(1).Text) = "" Then
 MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(1).SetFocus
 Exit Sub
End If
If Trim(Text1(2).Text) = "" Then
 MsgBox "确认密码不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(2).SetFocus
 Exit Sub
End If
If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
 MsgBox "两次密码不一致!", vbExclamation + vbOKOnly, "警告"
 Text1(2).SetFocus
 Exit Sub
End If
If optmang(0).Value = False And optuser(2).Value = False Then
 MsgBox "请选择权限!", vbExclamation + vbOKOnly, "警告"
  Text1(2).SetFocus
 Exit Sub
End If
If optmang(0).Value = True Then
    qq = "manager"
Else
    qq = "user"
End If
 Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
 sql = "select * from use where username='" & Trim(Text1(3).Text) & "'"
 Adodc1.CommandType = adCmdText
 Adodc1.RecordSource = sql
 Adodc1.Refresh
 If Adodc1.Recordset.EOF = True Then
    MsgBox "对不起,没此用户记录!", vbOKOnly, "查询"
    Exit Sub
 End If
 Adodc1.Recordset.Delete
 Adodc1.Refresh
 Adodc1.Recordset.AddNew
 Adodc1.Recordset.Fields("username").Value = Trim(Text1(0).Text)
 Adodc1.Recordset.Fields("password").Value = Trim(Text1(2).Text)
 Adodc1.Recordset.Fields("ident").Value = qq
 Adodc1.Recordset.Update
 Adodc1.Refresh
 MsgBox " 修改成功!", vbExclamation + vbOKOnly, "警告"
 Text1(0).Text = ""
 Text1(1).Text = ""
 Text1(2).Text = ""
 Text1(3).Text = ""
 Text1(4).Text = ""
 Text1(5).Text = ""
 optmang(0).Value = False
 optuser(2).Value = False
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
If Trim(Text1(3).Text) = "" Then
 MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(3).SetFocus
 Exit Sub
End If
If Trim(Text1(4).Text) = "" Then
 MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
 Text1(4).SetFocus
 Exit Sub
End If
If Trim(Text1(4).Text) <> Trim(Text1(5).Text) Then
 MsgBox "两次密码不一致!", vbExclamation + vbOKOnly, "警告"
 Text1(5).SetFocus
 Exit Sub
End If
 Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
 sql = "select * from use where username='" & Trim(Text1(3).Text) & "'"
 Adodc1.CommandType = adCmdText
 Adodc1.RecordSource = sql
 Adodc1.Refresh
 If Adodc1.Recordset.EOF = True Then
    MsgBox "对不起,没此用户记录!", vbOKOnly, "查询"
    Exit Sub
 End If
 Adodc1.Recordset.Delete
 Adodc1.Refresh
 MsgBox " 删除成功!", vbInformation + vbOKOnly, "警告"
 Text1(0).Text = ""
 Text1(1).Text = ""
 Text1(2).Text = ""
 Text1(3).Text = ""
 Text1(4).Text = ""
 Text1(5).Text = ""
 optmang(0).Value = False
 optuser(2).Value = False
End Sub

Private Sub optmang_Click(Index As Integer)
ident = "manager"
End Sub

Private Sub optuser_Click(Index As Integer)
ident = "user"
End Sub

⌨️ 快捷键说明

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