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

📄 frmlog.frm

📁 这是一套超市完整的代码
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frmlog 
   Caption         =   "登陆窗口"
   ClientHeight    =   2340
   ClientLeft      =   5370
   ClientTop       =   3180
   ClientWidth     =   4095
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2340
   ScaleWidth      =   4095
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   120
      Top             =   120
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Cmdexit 
      BackColor       =   &H80000014&
      Caption         =   "取消"
      Height          =   375
      Left            =   2400
      TabIndex        =   5
      Top             =   1680
      Width           =   855
   End
   Begin VB.CommandButton Cmdlog 
      BackColor       =   &H8000000E&
      Caption         =   "登陆"
      Height          =   375
      Left            =   960
      TabIndex        =   4
      Top             =   1680
      Width           =   855
   End
   Begin VB.TextBox Txtpassword 
      BorderStyle     =   0  'None
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   3
      Text            =   "lc"
      Top             =   1080
      Width           =   1935
   End
   Begin VB.TextBox Txtuser 
      BorderStyle     =   0  'None
      Height          =   375
      Left            =   1800
      TabIndex        =   1
      Text            =   "lc"
      Top             =   480
      Width           =   1935
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      Caption         =   "密码:"
      Height          =   375
      Left            =   840
      TabIndex        =   2
      Top             =   1080
      Width           =   735
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      Caption         =   "用户ID:"
      Height          =   255
      Left            =   720
      TabIndex        =   0
      Top             =   600
      Width           =   855
   End
End
Attribute VB_Name = "Frmlog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub Cmdexit_Click()
    Unload Me
End Sub

Private Sub Cmdlog_Click()
    'Txtuser.Text = GetMD5("lc")
    'Dim Mcon As ADODB.Connection
    'Set Mcon = New ADODB.Connection
    'Dim sid As String
    Dim pss As String
    Dim rsUserId As New ADODB.Recordset
    Dim bool As Boolean
    '打开数据库的连接
    If Mcon.State = 0 Then Mcon.Open "Provider=sqloledb;Data Source=172.26.10.5;Initial Catalog=SuperMarketdb;User Id=sa;Password=kof;"
    'Call link
    
    '打开用户表
    rsUserId.Open "SELECT UserName,UserPW FROM [User]", Mcon, adOpenStatic, adLockBatchOptimistic
    Do While Not rsUserId.EOF
    sid = rsUserId!UserName
    pss = rsUserId!UserPW
    bool = False
    '判断登陆
    If StrComp(sid, Txtuser, 1) = 0 And StrComp(pss, GetMD5(Txtpassword), 1) = 0 Then
        bool = True
        Unload Me
        Exit Do
        
        ElseIf sid <> Txtuser Or pss <> GetMD5(Txtpassword) Then bool = False

    End If
    rsUserId.MoveNext
    Loop
    If bool = True Then
        menu.Show 1
        
        Exit Sub
        Else
            MsgBox "用户名或者密码不正确,请重新输入!", , "提示:"
            Txtuser = ""
            Txtpassword = ""
            Txtuser.SetFocus
            Exit Sub
    End If
End Sub



Private Sub Form_Load()
    Adodc1.Visible = False
    'Txtuser.Text = ""
    'Txtpassword.Text = ""
End Sub

⌨️ 快捷键说明

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