📄 password.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Password
Caption = "口令设置"
ClientHeight = 4140
ClientLeft = 60
ClientTop = 465
ClientWidth = 6105
Icon = "Password.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 4140
ScaleWidth = 6105
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 2400
Top = 3600
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_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= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=CARS"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "CARS"
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 Command2
Caption = "退出"
Height = 540
Left = 3960
TabIndex = 10
Top = 3240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确认"
Height = 495
Left = 720
TabIndex = 9
Top = 3240
Width = 1455
End
Begin VB.Frame Frame1
Caption = "密码更改"
Height = 2535
Left = 360
TabIndex = 0
Top = 240
Width = 5175
Begin VB.TextBox Text4
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 8
Top = 2160
Width = 1815
End
Begin VB.TextBox Text3
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 7
Top = 1560
Width = 1815
End
Begin VB.TextBox Text2
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 6
Top = 960
Width = 1815
End
Begin VB.TextBox Text1
Height = 270
Left = 1560
TabIndex = 5
Top = 360
Width = 2175
End
Begin VB.Label Label4
Caption = "新口令确认:"
Height = 255
Left = 240
TabIndex = 4
Top = 2160
Width = 1095
End
Begin VB.Label Label3
Caption = "新口令:"
Height = 255
Left = 240
TabIndex = 3
Top = 1560
Width = 735
End
Begin VB.Label Label2
Caption = "旧口令:"
Height = 255
Left = 240
TabIndex = 2
Top = 960
Width = 735
End
Begin VB.Label Label1
Caption = "操作员名称:"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "Password"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public adoCon As New ADODB.Connection
Public rs As New ADODB.Recordset
Dim TIM As Integer
Public Sub main()
Set adoCon = New ADODB.Connection
adoCon.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=bai;password=052606241;Initial Catalog=CARS;Data Source=5c92669bd5be43c"
End Sub
Private Sub Command1_Click()
Call main
If Text3.Text = "" Then
MsgBox "新密码不能为空!"
Text3.SetFocus: Exit Sub
End If
If Text3.Text <> Text4.Text Then
MsgBox "两次输入密码值不相等,请重新输入!"
Text3.Text = ""
Text4.Text = ""
Text3.SetFocus: Exit Sub
End If
rs.Open "select * from 权限信息表 where 操作员名称='" & Text1.Text & "'", adoCon, adOpenKeyset, adLockOptimistic
rs.Fields("密码") = Text3.Text
rs.Update
MsgBox "操作员资料修改成功!", 0, "提示信息"
rs.Close
End Sub
Private Sub Command2_Click()
Unload Password
End Sub
Private Sub Form_Load()
TIM = 0
End Sub
Private Sub Text2_LostFocus()
Dim MESSAGE As String
Dim MESSAGE1 As String
Adodc1.RecordSource = "select * from 权限信息表 where 操作员名称= '" + Trim(Text1.Text) + "'"
Adodc1.Refresh
If Text1.Text <> "" And Text2.Text = Trim(Adodc1.Recordset.Fields("密码")) Then
Text3.SetFocus
Else
If TIM = 3 Then
MESSAGE = MsgBox("您的密码输入错误次数以达最大,请向系统管理员查询!", 0, "")
If MESSAGE = vbOK Then
End
End If
End If
If Text2.Text <> Adodc1.Recordset.Fields("密码") Then
MsgBox ("密码错误,请重新输入密码!")
TIM = TIM + 1
Text2.Text = ""
Text2.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -