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

📄 form1.frm

📁 售楼管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form formLogin 
   BackColor       =   &H00C0FFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "登陆"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   2280
      TabIndex        =   4
      Top             =   2040
      Width           =   975
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   375
      Left            =   600
      TabIndex        =   3
      Top             =   2040
      Width           =   855
   End
   Begin VB.TextBox txtPwd 
      Height          =   375
      Left            =   1920
      TabIndex        =   2
      Top             =   840
      Width           =   1815
   End
   Begin VB.ComboBox cmbName 
      Height          =   300
      Left            =   1920
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   240
      Width           =   1815
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      BackColor       =   &H00C0FFFF&
      Caption         =   "密码:"
      ForeColor       =   &H00C000C0&
      Height          =   375
      Left            =   480
      TabIndex        =   5
      Top             =   960
      Width           =   1095
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackColor       =   &H00C0FFFF&
      Caption         =   "用户名:"
      ForeColor       =   &H00C000C0&
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "formLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cnt As Integer  '记录登陆失败次数
Dim sql As String
Dim rs_login As New ADODB.Recordset

Private Sub cmdCancel_Click()
conn.Close
Set conn = Nothing
Unload Me
End Sub

Private Sub cmdOK_Click()
If Trim(cmbName.Text) = "" Then
    MsgBox "没有这个用户", vbOKOnly + vbExclamation, "提示"
    cmbName.SetFocus
Else
    sql = "select * from 系统管理表 where czyh='" & cmbName.Text & "'"
    rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
    If rs_login.EOF = True Then
        MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
        cmbName.SetFocus
        rs_login.Close
    Else
        If Trim(rs_login.Fields(1)) = Trim(txtPwd.Text) Then
            userName = cmbName.Text
            userType = rs_login.Fields(2)
            Unload Me
            FormMain.Show
            rs_login.Close
            Exit Sub
        Else
            MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
            txtPwd.SetFocus
            rs_login.Close
        End If
    End If
End If
cnt = cnt + 1
If cnt = 3 Then
    MsgBox "重试次数过多!", vbExclamation, ""
    Unload Me
End If
End Sub

Private Sub Form_Load()
ConnectionString = "provider=Microsoft.jet.oledb.4.0;data source=" & App.Path & "\house.mdb"
conn.Open ConnectionString
sql = "select * from 系统管理表"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = False Then
    Do While rs_login.EOF = False
        cmbName.AddItem (rs_login.Fields(0))
        rs_login.MoveNext
    Loop
    cmbName.ListIndex = 0 '默认显示第一个子域
End If
rs_login.Close
cnt = 0
End Sub



Private Sub txtPwd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    cmdOK = True
End If
End Sub

⌨️ 快捷键说明

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