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

📄 登录界面.frm

📁 基于VB+SQL Server的零食销售管理系统设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form 登录界面 
   AutoRedraw      =   -1  'True
   Caption         =   "登录"
   ClientHeight    =   5730
   ClientLeft      =   4560
   ClientTop       =   2445
   ClientWidth     =   7590
   LinkTopic       =   "Form1"
   Picture         =   "登录界面.frx":0000
   ScaleHeight     =   5730
   ScaleWidth      =   7590
   Begin VB.CommandButton cal 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3000
      TabIndex        =   6
      Top             =   3720
      Width           =   1335
   End
   Begin VB.CommandButton ok 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   600
      TabIndex        =   5
      Top             =   3720
      Width           =   1335
   End
   Begin VB.TextBox password 
      Height          =   495
      Left            =   2400
      TabIndex        =   4
      Top             =   2280
      Width           =   1935
   End
   Begin VB.TextBox user 
      Height          =   495
      Left            =   2400
      TabIndex        =   3
      Top             =   1440
      Width           =   1935
   End
   Begin VB.Label label3 
      Caption         =   "登录密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   600
      TabIndex        =   2
      Top             =   2400
      Width           =   1335
   End
   Begin VB.Label label2 
      Caption         =   "用户名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   600
      TabIndex        =   1
      Top             =   1560
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   "零食销售管理系统"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   24
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   0
      Top             =   360
      Width           =   4095
   End
End
Attribute VB_Name = "登录界面"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mycon As ADODB.Connection
Dim myres As ADODB.Recordset

Private Sub ok_Click()
   Dim username As String
   Dim userpassword As String
   username = Trim(user.Text)
   yonghuming = username
   userpassword = Trim(password.Text)
   If user.Text = "" Then
     MsgBox "用户名不能为空!", vbOKOnly + vbInformation, "友情提示"
     user.SetFocus
     Exit Sub
   End If
   If password.Text = "" Then
     MsgBox "密码不能为空!", vbOKOnly + vbInformation, "友情提示"
     password.SetFocus
     Exit Sub
   End If
   Dim str As New ADODB.Recordset
   Set str = New ADODB.Recordset
   
   str.Open "select 用户名,登录密码 from 管理员信息 where 用户名='" & username & "' and 登录密码='" & userpassword & "'", mycon, adOpenDynamic, adLockOptimistic
    
   If str.EOF Or str.BOF Then
          MsgBox "对不起,用户名不存在或密码不正确!", vbOKOnly + vbQuestion, "警告"
          user.SetFocus
          user.Text = ""
          password.Text = ""
       
    Else
       Unload Me
       系统主页.Show
       mycon.Close
Set mycon = Nothing
    End If
 
End Sub

Private Sub cal_Click()
Unload Me

End Sub

Private Sub Form_Load()
   Set mycon = New ADODB.Connection
   mycon.Open "dsn=my", "sa"
   Set myres = New ADODB.Recordset
   myres.Open "select 用户名,登录密码 from 管理员信息", mycon, adOpenDynamic, adLockOptimistic
   password.Text = "": password.PasswordChar = "*"
End Sub

⌨️ 快捷键说明

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