login.frm
来自「企业管理系统,用ACESS2000的数据库系统和ADO连接接口」· FRM 代码 · 共 107 行
FRM
107 行
VERSION 5.00
Begin VB.Form login
Caption = "密码登陆"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 615
Left = 2160
TabIndex = 2
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Default = -1 'True
Height = 615
Left = 720
TabIndex = 1
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
Height = 615
IMEMode = 3 'DISABLE
Left = 2040
PasswordChar = "*"
TabIndex = 0
Top = 360
Width = 1095
End
Begin VB.Label Label1
Caption = "请输入密码:"
Height = 255
Left = 840
TabIndex = 3
Top = 600
Width = 1095
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Conn As ADODB.Connection
Private Rst As New ADODB.Recordset
Private Sub Command1_Click()
If (Rst.State = adStateOpen) Then
Rst.Close
End If
Rst.CursorLocation = adUseClient
Rst.Open "Select * From userb", Conn, adOpenKeyset, adLockPessimistic
If Rst.Fields("mm").Value = Text1.Text Then
Unload Me
Form1.Show
Else
MsgBox "密码错误,请重新输入!"
Text1.Text = ""
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Dim ConString As String
ConString = "Provider=Microsoft.Jet.OleDb.4.0;Persist Security Info = False;" _
& "Data Source =" & App.Path & "\db1.mdb;Jet OleDb:DataBase Password=123456"
Set Conn = CreateObject("ADODB.Connection")
With Conn
.ConnectionString = ConString
.Open
End With
Rst.CursorLocation = adUseClient
Rst.Open "Select * From userb", Conn, adOpenKeyset, adLockPessimistic, adCmdText
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?