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

📄 form1.frm

📁 这是一个仓库管理系统做不全
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1950
   ClientLeft      =   5175
   ClientTop       =   3600
   ClientWidth     =   3840
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "Form1.frx":0000
   ScaleHeight     =   1950
   ScaleWidth      =   3840
   Begin VB.TextBox txtName 
      Height          =   315
      Left            =   1395
      TabIndex        =   0
      Top             =   360
      Width           =   1935
   End
   Begin VB.TextBox txtPwd 
      Height          =   315
      IMEMode         =   3  'DISABLE
      Left            =   1395
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   765
      Width           =   1935
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   315
      Left            =   1095
      TabIndex        =   2
      Top             =   1245
      Width           =   945
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   315
      Left            =   2250
      TabIndex        =   3
      Top             =   1260
      Width           =   945
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名"
      Height          =   180
      Left            =   720
      TabIndex        =   5
      Top             =   420
      Width           =   540
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "口  令"
      Height          =   180
      Left            =   720
      TabIndex        =   4
      Top             =   825
      Width           =   540
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
 If MsgBox("你选择了退出系统登录,退出将不能启动管理系统!" & vbCrLf _
              & "是否真的退出?", vbYesNo + vbQuestion, "登录验证") = vbYes Then
       End
    End If
End Sub

Private Sub cmdOK_Click()
Dim objCn As Connection, objRs As Recordset, strSQL$
    '检验是否输入用户名
    If Trim(txtName) = "" Then
        MsgBox "请输入用户名!", vbExclamation, "登录验证"
        txtName = ""
        txtName.SetFocus
        Exit Sub
    End If
    '检验是否输入登录口令
    If Trim(txtPwd) = "" Then
        MsgBox "请输入登录口令!", vbExclamation, "登录验证"
        txtPwd = ""
        txtPwd.SetFocus
        Exit Sub
    End If
    '创建与数据库的联接
    Set objCn = New Connection                  '实例化联接对象
    With objCn                                  '建立数据库联接
        .Provider = "SQLOLEDB"
        .ConnectionString = "User ID=sa;PWD=123;Data Source=(local);" & _
                            "Initial Catalog=skcgl"
        .Open
    End With
    Dim objLog As New Recordset
    strSQL = "select * from dl where mc='" & Trim(txtName) & "'"
    '执行查询获得用户登陆密码
    Set objRs = New Recordset
    With objRs
        Set .ActiveConnection = objCn
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .Open strSQL
        If .RecordCount < 1 Then
            MsgBox "用户名输入错误!", vbCritical, "登录验证"
            txtName.SetFocus
            txtName.SelStart = 0
            txtName.SelLength = Len(txtName)
        Else
        If Trim(.Fields("mm")) = Trim(txtPwd) Then
            MsgBox "登录成功!", vbInformation, "登录成功"
             If Trim(.Fields("qx")) <> Trim("管理员") Then
             MDIForm1.gl.Enabled = False
             MDIForm1.tjhw.Enabled = False
             MDIForm1.xghw.Enabled = False
             MDIForm1.schw.Enabled = False
             MDIForm1.sc.Enabled = False
             MDIForm1.xg.Enabled = False
             MDIForm1.sc1.Enabled = False
             MDIForm1.xg1.Enabled = False
             Else
             MDIForm1.gl.Enabled = True
             MDIForm1.tjhw.Enabled = True
             MDIForm1.xghw.Enabled = True
             MDIForm1.schw.Enabled = True
             MDIForm1.sc.Enabled = True
             MDIForm1.xg.Enabled = True
             MDIForm1.sc1.Enabled = True
             MDIForm1.xg1.Enabled = True
             End If
             Form1.Hide
             MDIForm1.Show
            Else
             MsgBox "口令错误,请重新输入!", vbCritical, "登录验证"
                txtPwd.SetFocus
                txtPwd = ""
            End If
        End If
     End With
    objCn.Close             '关闭数据库连接
    Set objCn = Nothing     '释放数据库连接
    Set objRs = Nothing
End Sub

Private Sub Form_Load()
 txtName = ""
 txtPwd = ""
End Sub

⌨️ 快捷键说明

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