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

📄 frmadduser.frm

📁 是医药卫生综合管理系统的一部分.院长查询管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmadduser 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加系统用户"
   ClientHeight    =   2475
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4470
   Icon            =   "frmadduser.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Picture         =   "frmadduser.frx":030A
   ScaleHeight     =   2475
   ScaleWidth      =   4470
   ShowInTaskbar   =   0   'False
   Begin VB.OptionButton Option2 
      BackColor       =   &H00E0E0E0&
      Height          =   180
      Left            =   1860
      TabIndex        =   11
      Top             =   1020
      Width           =   210
   End
   Begin VB.OptionButton Option1 
      BackColor       =   &H00E0E0E0&
      Height          =   180
      Left            =   840
      TabIndex        =   10
      Top             =   1020
      Width           =   210
   End
   Begin VB.CommandButton cmdclose 
      Caption         =   "关闭&(C)"
      Height          =   300
      Left            =   3360
      TabIndex        =   8
      Top             =   2040
      Width           =   1000
   End
   Begin VB.CommandButton cmdupdate 
      Caption         =   "更新&(C)"
      Height          =   300
      Left            =   2280
      TabIndex        =   7
      Top             =   2040
      Width           =   1000
   End
   Begin VB.CommandButton cmddelete 
      Caption         =   "删除&(D)"
      Height          =   300
      Left            =   1200
      TabIndex        =   6
      Top             =   2040
      Width           =   1000
   End
   Begin VB.CommandButton cmdadd 
      Caption         =   "添加&(A)"
      Height          =   300
      Left            =   120
      TabIndex        =   5
      Top             =   2040
      Width           =   1000
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   240
      Top             =   1320
      Width           =   2640
      _ExtentX        =   4657
      _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       =   16777215
      ForeColor       =   16711680
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   ""
      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.TextBox Text2 
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H000000FF&
      Height          =   300
      Left            =   840
      TabIndex        =   4
      Top             =   600
      Width           =   2000
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H000000FF&
      Height          =   300
      Left            =   840
      TabIndex        =   3
      Top             =   240
      Width           =   2000
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "超级用户"
      Height          =   180
      Left            =   2100
      TabIndex        =   13
      Top             =   1020
      Width           =   720
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "普通用户"
      Height          =   180
      Left            =   1080
      TabIndex        =   12
      Top             =   1020
      Width           =   720
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000000FF&
      X1              =   120
      X2              =   4320
      Y1              =   1900
      Y2              =   1900
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "    注意:用户名和密码不得超过10个中文字符或20个英文字母,密码最好用英文或数字。"
      ForeColor       =   &H00000000&
      Height          =   1440
      Left            =   3120
      TabIndex        =   9
      Top             =   240
      Width           =   1155
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "权  限"
      Height          =   180
      Left            =   225
      TabIndex        =   2
      Top             =   1020
      Width           =   540
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "密  码"
      Height          =   180
      Left            =   225
      TabIndex        =   1
      Top             =   675
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名"
      Height          =   180
      Left            =   240
      TabIndex        =   0
      Top             =   300
      Width           =   540
   End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public uright As String

Private Sub Form_Load()
On Error GoTo err1
frmadduser.Top = (frmmain.Height - frmadduser.Height) / 2 - 500
frmadduser.Left = (frmmain.Width - frmadduser.Width) / 2
Option1.Value = True
cmdupdate.Caption = "修改"
With Adodc1
.ConnectionString = frmlogin.conn
.RecordSource = "select * from usertab order by ID"
.Refresh
.Caption = "共有用户" & .Recordset.RecordCount & "个"
Set Text1.DataSource = Adodc1
Set Text2.DataSource = Adodc1
Text1.DataField = "用户名"
Text2.DataField = "密码"
End With
Exit Sub
err1:
MsgBox "数据库连接失败!"
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Screen.MousePointer = vbDefault
  frmlogin.userright = "1"
End Sub
Private Sub cmdAdd_Click()
  On Error GoTo AddErr
  If Text1.Text = "" Or Text2.Text = "" Then
  MsgBox "用户名和密码必须填写!"
  Else
  With Adodc1
  .Recordset.AddNew
  .Recordset.Fields("权限") = uright
  End With
  cmdadd.Enabled = False
  cmdupdate.Caption = "保存"
  End If
  Exit Sub
AddErr:
  MsgBox "数据添加失败!可能是数据库连接出错。"
End Sub

Private Sub cmdDelete_Click()
  On Error GoTo DeleteErr
  With Adodc1.Recordset
    If .Fields("用户名") = "systemuser" Then
    MsgBox "系统默认用户不能删除!"
     Else
    .Delete
    .MoveNext
    .UpdateBatch
    If .EOF Then .MoveLast
    End If
  End With
  Exit Sub
DeleteErr:
  MsgBox "数据库已空或无法连接数据!"
End Sub

Private Sub cmdUpdate_Click()
   On Error GoTo UpdateErr
  If cmdupdate.Caption = "保存" Then
  If Adodc1.Recordset.Fields("用户名") = "systemuser" Then
    MsgBox "系统默认用户名不能修改,密码可以修改!"
    Else
  Adodc1.Recordset.Update
  cmdadd.Enabled = True
  cmdupdate.Caption = "修改"
  End If
  Else
  Adodc1.Recordset.Fields("用户名") = Text1.Text
  Adodc1.Recordset.Fields("密码") = Text2.Text
  Adodc1.Recordset.Fields("权限") = uright
  End If
  Exit Sub
UpdateErr:
  MsgBox "数据无记录或数据库损坏!"
End Sub

Private Sub cmdClose_Click()
  Unload Me
  MsgBox "系统已将用户权限修改为普通用户!"
End Sub

Private Sub Option2_Click()
uright = "0"
cmdupdate.Caption = "保存"
End Sub
Private Sub Option1_Click()
uright = "1"
cmdupdate.Caption = "保存"
End Sub

Private Sub Text1_Change()
If Text1.Text = "systemuser" Then
Text1.Enabled = False
Else
Text1.Enabled = True
End If
cmdupdate.Caption = "保存"
End Sub
Private Sub Text2_Change()
cmdupdate.Caption = "保存"
End Sub

⌨️ 快捷键说明

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