📄 frmpower.frm
字号:
VERSION 5.00
Begin VB.Form frmPower
Caption = "权限识别"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 2295
Left = 120
TabIndex = 0
Top = 360
Width = 4455
Begin VB.TextBox txtUserName
Height = 270
Left = 1560
TabIndex = 6
Top = 480
Width = 2295
End
Begin VB.TextBox txtPassword
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 3
Top = 870
Width = 2325
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 360
Left = 750
TabIndex = 2
Tag = "确定"
Top = 1365
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 360
Left = 2355
TabIndex = 1
Tag = "取消"
Top = 1365
Width = 1140
End
Begin VB.Label lblLabels
Caption = "用户名称:"
Height = 255
Index = 0
Left = 360
TabIndex = 5
Tag = "用户名(&U):"
Top = 495
Width = 1080
End
Begin VB.Label lblLabels
Caption = "密码(&P):"
Height = 255
Index = 1
Left = 360
TabIndex = 4
Tag = "密码(&P):"
Top = 885
Width = 1080
End
End
End
Attribute VB_Name = "frmPower"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OK_power As Boolean
Dim mconn As New ADODB.Connection
Private Sub Form_Load()
'txtUserName.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
txtUserName.SelStart = 0
txtUserName.SelLength = Len(txtPassword.Text)
End Sub
Private Sub cmdCancel_Click()
OK_power = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
Dim sql As String, rs As New ADODB.Recordset
sql = "select * from passwd where username='" & txtUserName.Text & "'"
rs.CursorLocation = adUseClient
rs.Open sql, mconn, adOpenKeyset, adLockPessimistic
If rs.RecordCount = 0 Then
MsgBox "no user", vbOKOnly
rs.Close
Exit Sub
End If
'ToDo: 创建测试密码是否正确
'检查正确密码
If txtPassword.Text = rs("pass") Then
OK_power = True
rs.Close
Me.Hide
Else
MsgBox "密码错误,再试一次!", , "登录"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -