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

📄 frmdenglu.frm

📁 用vb编的一个酒店客房管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmDengLu 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   2010
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   4140
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1187.574
   ScaleMode       =   0  'User
   ScaleWidth      =   3887.236
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   1200
      Top             =   1560
      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        =   ""
      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.TextBox txtBianHao 
      Height          =   345
      Left            =   1320
      TabIndex        =   1
      Top             =   135
      Width           =   2325
   End
   Begin VB.CommandButton cmdDengLu 
      Caption         =   "登录"
      Default         =   -1  'True
      Height          =   390
      Left            =   495
      TabIndex        =   4
      Top             =   1020
      Width           =   1140
   End
   Begin VB.CommandButton cmdTuiChu 
      Cancel          =   -1  'True
      Caption         =   "退出"
      Height          =   390
      Left            =   2100
      TabIndex        =   5
      Top             =   1020
      Width           =   1140
   End
   Begin VB.TextBox txtMiMa 
      Height          =   345
      IMEMode         =   3  'DISABLE
      Left            =   1290
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   525
      Width           =   2325
   End
   Begin VB.Label lblLabels 
      Caption         =   "编号"
      Height          =   270
      Index           =   0
      Left            =   105
      TabIndex        =   0
      Top             =   150
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      Caption         =   "密码"
      Height          =   270
      Index           =   1
      Left            =   105
      TabIndex        =   2
      Top             =   540
      Width           =   1080
   End
End
Attribute VB_Name = "frmDengLu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim CURRENT_USER_NUMBER  As Long  '记录当前用户的员工编号
Dim CURRENT_USER_TYPE As String     '记录当前用户的职位类型
Const MAX_LOGTIMES   As Integer = 3 '设定尝试登陆的最大次数
Dim isExit As Boolean

Private Sub cmdDengLu_Click()
 
 If Trim(txtBianHao) = "" Then
    MsgBox "请输入员工编号", vbExclamation
    txtBianHao = ""
    txtBianHao.SetFocus
    Exit Sub
End If
If Trim(txtMiMa) = "" Then
    MsgBox "请输入密码!", vbExclamation
    txtMiMa = ""
    txtMiMa.SetFocus
    Exit Sub
End If

Static intLogTimes As Integer  '记录用户请求验证的次数

intLogTimes = intLogTimes + 1
'判断是不是超过允许的登录验证次数,若超过程序结束
If intLogTimes > MAX_LOGTIMES Then
    MsgBox "你已经超过允许的登陆验证次数!" & vbCrLf & "程序将结束", vbCritical
    End
End If

Dim objCn As Connection
Set objCn = New Connection
With objCn
    .Provider = "MSDASQL.1"
    .ConnectionString = "Persist Security Info=False;User ID=da;Data Source=jiudian"
    .Open
End With

Dim strSql As String
strSql = "select * from YuanGongXinXi where bianHao=" & Trim(txtBianHao)
Dim objLog As Recordset
Set objLog = New Recordset
With objLog
    Set .ActiveConnection = objCn
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .Open strSql
    If .RecordCount < 1 Then
        MsgBox "用户名输入错误!" & vbCrLf & "请重新输入!", vbCritical, "登录验证"
        txtBianHao.SetFocus
        txtBianHao.SelStart = 0
    Else
        If .Fields("miMa") <> Trim(txtMiMa) Then
            MsgBox "密码错误,请重新输入!", vbCritical, "密码错误"
            txtMiMa = ""
            txtMiMa.SetFocus
        Else
            CURRENT_USER_NUMBER = .Fields("bianHao")
            CURRENT_USER_TYPE = .Fields("zhiWei")
            isExit = False
            Unload Me
            frmFangJianGuanLi.Show
        End If
    End If
End With

objCn.Close
Set objCn = Nothing
Set objLog = Nothing
    
End Sub

Private Sub cmdTuiChu_Click()
    
    If MsgBox("是否退出系统?", vbYesNo, "酒店销售管理系统") = vbYes Then
        Unload Me
        End
    End If
    
End Sub

Private Sub Form_Load()

    txtBianHao = ""
    txtMiMa = ""
    isExit = True
    
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    
    If isExit Then
        If MsgBox("是否退出系统?", vbYesNo, "酒店销售管理系统") = vbNo Then
            Cancel = 1
        End If
    End If
End Sub

⌨️ 快捷键说明

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