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

📄 登录窗口.frm

📁 zui hao yong de VBxitong
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   2445
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   3795
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2445
   ScaleWidth      =   3795
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   330
      Left            =   2280
      TabIndex        =   5
      Top             =   1800
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "登录"
      Height          =   330
      Left            =   1200
      TabIndex        =   4
      Top             =   1800
      Width           =   975
   End
   Begin VB.TextBox txtPassword 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1320
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   960
      Width           =   2055
   End
   Begin VB.TextBox txtName 
      Height          =   270
      Left            =   1320
      TabIndex        =   2
      Top             =   360
      Width           =   2055
   End
   Begin VB.Label Label3 
      Caption         =   "初始用户名 admin  ,密码 0"
      ForeColor       =   &H000000FF&
      Height          =   255
      Left            =   0
      TabIndex        =   6
      Top             =   1440
      Width           =   2655
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      Caption         =   "密码:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   1080
      Width           =   1095
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      Caption         =   "用户名:"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   480
      Width           =   1095
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
Dim rst As New ADODB.Recordset
Dim sql As String
Dim logon As Boolean
    logon = False
    sql = "select 用户名,密码,使用次数 from 用户 where 用户名='" & txtname.Text & "'"
    rst.Open sql, conn, adOpenKeyset, adLockOptimistic
    If rst.RecordCount <> 0 Then
        If rst.Fields("用户名") = txtname.Text And rst.Fields("密码") = txtPassword.Text Then
            rst.Fields("使用次数") = rst.Fields("使用次数") + 1
            logon = True
        End If
    End If
    rst.Update
    rst.Close
    Set rst = Nothing
    If logon Then
        Form1.UserName = txtname.Text
        Form1.Show
        Unload Me
    Else
        MsgBox "用户名或密码错误"
    End If
End Sub

Private Sub Command2_Click()
    End
End Sub

Private Sub Form_Load()
    If connectToDatabase() = False Then
        MsgBox "打开数据库失败"
        End
    End If
End Sub


⌨️ 快捷键说明

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