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

📄 fmuserpower.frm

📁 <Visual Basic 数据库开发实例精粹(第二版)>一书首先介绍了Visual Basic(简称VB)开发的技巧和重点技术
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDatGrd.ocx"
Begin VB.Form FMUserPower 
   Caption         =   "用户权限设置"
   ClientHeight    =   5265
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6300
   LinkTopic       =   "Form1"
   ScaleHeight     =   5265
   ScaleWidth      =   6300
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   5040
      TabIndex        =   4
      Top             =   4680
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   495
      Left            =   5040
      TabIndex        =   3
      Top             =   960
      Width           =   735
   End
   Begin VB.Frame Frame2 
      Height          =   1935
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   6255
      Begin VB.ComboBox CombRemake 
         DataField       =   "Remake"
         DataSource      =   "Adodc1"
         Height          =   300
         ItemData        =   "FMUserPower.frx":0000
         Left            =   2400
         List            =   "FMUserPower.frx":000D
         TabIndex        =   10
         Top             =   1320
         Width           =   1815
      End
      Begin VB.ComboBox CombUType 
         DataField       =   "UserType"
         DataSource      =   "Adodc1"
         Height          =   300
         ItemData        =   "FMUserPower.frx":002D
         Left            =   2400
         List            =   "FMUserPower.frx":003A
         TabIndex        =   9
         Top             =   780
         Width           =   1815
      End
      Begin VB.TextBox TextUserID 
         DataField       =   "UserID"
         DataSource      =   "Adodc1"
         Height          =   300
         Left            =   2400
         TabIndex        =   8
         Top             =   240
         Width           =   1815
      End
      Begin VB.Label Label3 
         Caption         =   "用户类型名称:"
         Height          =   255
         Left            =   720
         TabIndex        =   7
         Top             =   1320
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "用户类型编号:"
         Height          =   255
         Left            =   720
         TabIndex        =   6
         Top             =   840
         Width           =   1455
      End
      Begin VB.Label Label1 
         Caption         =   "用户ID:"
         Height          =   375
         Left            =   720
         TabIndex        =   5
         Top             =   360
         Width           =   1455
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   4440
      Top             =   3720
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      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        =   ""
      Password        =   ""
      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.Frame Frame1 
      Height          =   2535
      Left            =   0
      TabIndex        =   0
      Top             =   2040
      Width           =   6255
      Begin MSDataGridLib.DataGrid DataGrid1 
         Bindings        =   "FMUserPower.frx":0047
         Height          =   2175
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   6015
         _ExtentX        =   10610
         _ExtentY        =   3836
         _Version        =   393216
         AllowUpdate     =   0   'False
         HeadLines       =   1
         RowHeight       =   15
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   5
         BeginProperty Column00 
            DataField       =   "UserID"
            Caption         =   "用户ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "UserName"
            Caption         =   "用户名"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "UserPwd"
            Caption         =   "UserPwd"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "UserType"
            Caption         =   "用户类型编号"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "Remake"
            Caption         =   "用户类型名称"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               ColumnWidth     =   1200.189
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   1500.095
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   0
            EndProperty
            BeginProperty Column03 
               ColumnWidth     =   1200.189
            EndProperty
            BeginProperty Column04 
               ColumnWidth     =   1395.213
            EndProperty
         EndProperty
      End
   End
End
Attribute VB_Name = "FMUserPower"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub CombRemake_Click()

  Select Case Me.CombRemake.Text

    Case "管理员":
      Me.CombUType.Text = "0"

    Case "普通用户":
      Me.CombUType.Text = "1"

    Case "高级用户":
      Me.CombUType.Text = "2"
  End Select

End Sub

Private Sub CombUType_Click()

  Select Case Me.CombUType.Text

    Case 0:
      Me.CombRemake.Text = "管理员"

    Case 1:
      Me.CombRemake.Text = "普通用户"

    Case 2:
      Me.CombRemake.Text = "高级用户"
  End Select

End Sub

Private Sub Command1_Click()
  Dim ModUserPower As New ADODB.Recordset
  Dim Str As String
  Dim sUserID As String
  Dim iUserType As String
  Dim sRemake As String

  If Trim(Me.TextUserID.Text) = "" Then
    MsgBox "请输入用户ID!"
    Exit Sub
  End If
    
  sUserID = Trim(Me.TextUserID.Text)
    
  If Trim(Me.CombUType.Text) = "" Then
    MsgBox "请输入用户类型编号!"
    Exit Sub
  End If
    
  iUserType = Trim(Me.CombUType.Text)
    
  If Trim(Me.CombRemake.Text) = "" Then
    MsgBox "请输入用户类型名称!"
    Exit Sub
  End If
    
  sRemake = Trim(Me.CombRemake.Text)
    
  Str = "select * from UserInfo where UserID='" & sUserID & "'"
  ModUserPower.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
  ModUserPower.MoveFirst
  ModUserPower.Fields("UserType").Value = Trim(Me.CombUType.Text)
  ModUserPower.Fields("Remake").Value = Trim(Me.CombRemake.Text)
  ModUserPower.Update
  ModUserPower.Close
  MsgBox "修改成功!"
    
  Me.TextUserID.Text = ""
  Me.CombUType.Text = ""
  Me.CombRemake.Text = ""
    
  Adodc1.Refresh
    
End Sub

Private Sub Command2_Click()
  Unload Me

End Sub

Private Sub Form_Load()
  Me.Top = (Screen.Height - Me.Height) / 2    '垂直方向居中
  Me.Left = (Screen.Width - Me.Height) / 2    '水平方向居中
  
  '设置Adodc连接字符串
  Adodc1.ConnectionString = g_ConnStr
  Adodc1.CommandType = adCmdTable
  Adodc1.RecordSource = "UserInfo"
  '设置Grid 与 Adodc1关联
  Set DataGrid1.DataSource = Adodc1
    
End Sub

⌨️ 快捷键说明

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