📄 frmpwdchange.frm
字号:
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmmanage
Caption = "用户管理"
ClientHeight = 3810
ClientLeft = 60
ClientTop = 345
ClientWidth = 3150
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3810
ScaleWidth = 3150
StartUpPosition = 2 '屏幕中心
Begin TabDlg.SSTab stabman
Height = 3375
Left = 120
TabIndex = 0
Top = 240
Width = 2895
_ExtentX = 5106
_ExtentY = 5953
_Version = 393216
Tabs = 2
TabHeight = 520
TabCaption(0) = "更改密码"
TabPicture(0) = "frmpwdchange.frx":0000
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "Label1"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "Label2"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "Command1"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).Control(3)= "Text1"
Tab(0).Control(3).Enabled= 0 'False
Tab(0).Control(4)= "Text2"
Tab(0).Control(4).Enabled= 0 'False
Tab(0).Control(5)= "Command2"
Tab(0).Control(5).Enabled= 0 'False
Tab(0).ControlCount= 6
TabCaption(1) = "添加用户"
TabPicture(1) = "frmpwdchange.frx":001C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "Command4"
Tab(1).Control(1)= "Command3"
Tab(1).Control(2)= "Text5"
Tab(1).Control(3)= "Text4"
Tab(1).Control(4)= "Text3"
Tab(1).Control(5)= "Label5"
Tab(1).Control(6)= "Label4"
Tab(1).Control(7)= "Label3"
Tab(1).ControlCount= 8
Begin VB.CommandButton Command4
Caption = "确认(&O)"
Height = 350
Left = -74640
TabIndex = 14
Top = 2640
Width = 950
End
Begin VB.CommandButton Command3
Caption = "取消(&C)"
Height = 350
Left = -73440
TabIndex = 13
Top = 2640
Width = 950
End
Begin VB.TextBox Text5
Height = 350
IMEMode = 3 'DISABLE
Left = -73560
PasswordChar = "*"
TabIndex = 11
Top = 1800
Width = 1100
End
Begin VB.TextBox Text4
Height = 350
IMEMode = 3 'DISABLE
Left = -73560
PasswordChar = "*"
TabIndex = 9
Top = 1200
Width = 1100
End
Begin VB.TextBox Text3
Height = 350
IMEMode = 3 'DISABLE
Left = -73560
TabIndex = 7
Top = 600
Width = 1100
End
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Height = 350
Left = 1560
TabIndex = 6
Top = 2640
Width = 950
End
Begin VB.TextBox Text2
Height = 350
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 5
Top = 1680
Width = 1100
End
Begin VB.TextBox Text1
Height = 350
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 3
Top = 840
Width = 1100
End
Begin VB.CommandButton Command1
Caption = "确认(&O)"
Height = 350
Left = 360
TabIndex = 1
Top = 2640
Width = 950
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "确认密码:"
Height = 180
Left = -74760
TabIndex = 12
Top = 1920
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "输入密码:"
Height = 180
Left = -74760
TabIndex = 10
Top = 1320
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "输入用户名:"
Height = 180
Left = -74760
TabIndex = 8
Top = 720
Width = 1080
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "请确认新密码:"
Height = 180
Left = 240
TabIndex = 4
Top = 1800
Width = 1260
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请输入新密码:"
Height = 180
Left = 240
TabIndex = 2
Top = 960
Width = 1260
End
End
End
Attribute VB_Name = "frmmanage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim rschange As New ADODB.Recordset
Set rschange = DataEnv.rsadmin
rschange.Open
Dim sql As String
If Trim(Text1.Text) <> Trim(Text2.Text) Then
MsgBox "密码不一致!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Else
'DataEnv.rsadminsql.Close
sql = "select * from tab_admin where name='" & mnusername & "'"
'DataEnv.rsadminsql.Open sql, conn, adOpenKeyset, adLockOptimistic
'rschange.Open sql, conn, adOpenKeyset, adLockPessimistic
DataEnv.rsadmin.Fields("pwd") = Text1.Text
DataEnv.rsadmin.Update
rschange.Close
MsgBox "密码修改成功", vbOKOnly + vbExclamation, ""
Unload Me
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Dim sql As String
Dim rs_add As New ADODB.Recordset
Set rs_add = DataEnv.rsadmin
rs_add.Open
If Trim(Text3.Text) = "" Then
MsgBox "用户名不能为空", vbOKOnly + vbExclamation, ""
Exit Sub
Text3.SetFocus
Else
sql = "select * from tab_admin"
'rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic
While (rs_add.EOF = False)
If Trim(rs_add.Fields(0)) = Trim(Text3.Text) Then
MsgBox "已有这个用户", vbOKOnly + vbExclamation, ""
Text3.SetFocus
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
'Combo1.Text = ""
Exit Sub
Else
rs_add.MoveNext
End If
Wend
If Trim(Text4.Text) <> Trim(Text5.Text) Then
MsgBox "两次密码不一致", vbOKOnly + vbExclamation, ""
Text4.SetFocus
Text4.Text = ""
Text5.Text = ""
Exit Sub
Else
rs_add.AddNew
rs_add.Fields("name") = Text3.Text
rs_add.Fields("pwd") = Text4.Text
'rs_add.Fields(2) = Combo1.Text
rs_add.Update
rs_add.Close
MsgBox "添加用户成功", vbOKOnly + vbExclamation, ""
Unload Me
End If
End If
End Sub
Private Sub stabman_GotFocus()
If stabman.Tab = 0 Then
Text1.SetFocus
Else
Text3.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -