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

📄 form2.frm

📁 射频卡收费系统 自主开发 可以用于任何商业收费场所
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "系统登录"
   ClientHeight    =   2355
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   6300
   Icon            =   "Form2.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2355
   ScaleWidth      =   6300
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "确  定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2040
      TabIndex        =   2
      Top             =   1620
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退  出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   4080
      TabIndex        =   3
      Top             =   1620
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      IMEMode         =   3  'DISABLE
      Left            =   2040
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   960
      Width           =   2415
   End
   Begin VB.ComboBox Combo1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2040
      TabIndex        =   0
      Top             =   360
      Width           =   2415
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "密  码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   240
      Left            =   1200
      TabIndex        =   5
      Top             =   1080
      Width           =   960
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   240
      Left            =   1200
      TabIndex        =   4
      Top             =   480
      Width           =   960
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim yonghu As Recordset
Dim lianjie As New Connection
Private Sub Combo1_Click()

    Text2.SetFocus
  
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
     Text2.SetFocus
   End If
End Sub

Private Sub Command1_Click()
'用户名是否为空-------------------------------------
   
   If Trim(Combo1.Text) = "" Then
      MsgBox "请选择用户名!", vbExclamation, "登陆验证"
      
      Combo1.SetFocus
      
      Exit Sub
      
   End If
   
'密码是否为空-----------------------------------------
   
   If Trim(Text2) = "" Then
      MsgBox "请输入密码!", vbExclamation, "登陆验证"
      Text2 = ""
      Text2.SetFocus
      Exit Sub
      
   End If
'登陆次数是否大于3-------------------------------------

   Static times As Integer
   times = times + 1
   If times > 3 Then
      MsgBox "你已经超过登陆验证次数!" & vbCr & "系统将结束!", vbCritical, "登陆验证"
      End
   End If
   
'定义yong 记录集---------------------------------------
Set yonghu = New Recordset
yonghu.CursorLocation = adUseClient
yonghu.CursorType = adOpenDynamic
yonghu.Open "select * from 权限 where 姓名='" & Trim(Combo1.Text) & "'", lianjie
 
If yonghu.RecordCount > 0 Then
    If Trim(yonghu.Fields("密码")) = Trim(Text2.Text) Then
        yonghuming = Trim(Combo1.Text)
        mima = Trim(Text2)
        quanxian = Trim(yonghu.Fields("权限"))
        Unload Me
        Form3.Show
    Else
        MsgBox "密码错误,请重新输入!", vbCritical, "登陆验证"
        Text2.SetFocus
        Text2 = ""
    End If
    

Else

    MsgBox "用户名输入错误!", vbCritical, "登陆验证"
    Combo1.SetFocus
End If
   
End Sub

Private Sub Command2_Click()
Unload Me

End Sub

Private Sub Form_Load()
   
lianjie.ConnectionString = dblianjie
lianjie.Open

   Set yonghu = New Recordset
   yonghu.CursorLocation = adUseClient
   yonghu.CursorType = adOpenDynamic
   yonghu.Open "select * from 权限 ", lianjie
   
   If yonghu.RecordCount > 0 Then
      
      yonghu.MoveFirst
      
      Do Until yonghu.EOF

        Combo1.AddItem Trim(yonghu.Fields("姓名"))
        yonghu.MoveNext
      Loop
   End If
   

      
End Sub



Private Sub Form_Unload(Cancel As Integer)

lianjie.Close
End Sub



Private Sub Label3_Click()

End Sub

Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2)
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then
  Command1.SetFocus
  End If
End Sub


⌨️ 快捷键说明

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