📄 frm_system.frm
字号:
VERSION 5.00
Begin VB.Form Frm_system
Caption = "密码修改"
ClientHeight = 2520
ClientLeft = 60
ClientTop = 345
ClientWidth = 4365
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2520
ScaleWidth = 4365
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text4
Height = 270
Left = 2280
TabIndex = 9
Top = 1320
Width = 1455
End
Begin VB.TextBox Text3
Height = 375
Left = 3720
TabIndex = 8
Top = 1080
Visible = 0 'False
Width = 1215
End
Begin VB.TextBox Text2
Height = 270
Left = 2280
TabIndex = 4
Top = 960
Width = 1455
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Frm_system.frx":0000
Left = 2280
List = "Frm_system.frx":000A
TabIndex = 3
Top = 240
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 2520
TabIndex = 2
Top = 1920
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "更改"
Height = 375
Left = 720
TabIndex = 1
Top = 1920
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Left = 2280
TabIndex = 0
Top = 600
Width = 1455
End
Begin VB.Label Label4
Caption = "再次输入新密码:"
Height = 255
Left = 720
TabIndex = 10
Top = 1320
Width = 1575
End
Begin VB.Label Label3
Caption = "新密码:"
Height = 255
Left = 720
TabIndex = 7
Top = 960
Width = 1215
End
Begin VB.Label Label2
Caption = "旧密码:"
Height = 255
Left = 720
TabIndex = 6
Top = 600
Width = 1335
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 255
Left = 720
TabIndex = 5
Top = 240
Width = 1215
End
End
Attribute VB_Name = "Frm_system"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private con As New ADODB.Connection
Private rs As New ADODB.Recordset
Private con1 As New ADODB.Connection
Private rs1 As New ADODB.Recordset
Private str As String
Private str1 As String
Private Sub Command1_Click()
Set con1 = New ADODB.Connection
con1.ConnectionString = "provider=sqloledb;persist security info = false;user id=sa;password=;initial catalog=company;data source=WGH"
con1.Open
Set rs1 = New ADODB.Recordset
If Combo1.Text = "普通用户" Then
str1 = "select * from 操作用户 where 姓名='" & Combo1.Text & "'"
Set rs1 = con1.Execute(str1)
Text3.Text = Trim(rs1.Fields("密码"))
rs1.Close
End If
If Combo1.Text = "超级用户" Then
str1 = "select * from 操作用户 where 姓名='" & Combo1.Text & "'"
Set rs1 = con1.Execute(str1)
Text3.Text = Trim(rs1.Fields("密码"))
rs1.Close
End If
If Text1.Text = Text3.Text Then
If Trim(Text2.Text) = Trim(Text4.Text) Then
Dim sql As String
sql = "update 操作用户 set 密码='" & Text2.Text & "'where 姓名='" & Combo1.Text & "'"
con.Execute sql
MsgBox "系统接受了你的新密码。"
Else
MsgBox "两次输入的新密码不一致"
Text2.Text = ""
Text4.Text = ""
Text1.Text = ""
Exit Sub
End If
Else
MsgBox "你的旧密码不正确!"
Text2.Text = ""
Text4.Text = ""
Text1.Text = ""
End If
'If Text1.Text = Text3.Text And Text4.Text = Text2.Text Then
'Dim SQL As String
'SQL = "update 操作用户 set 密码='" & Text2.Text & "'where 姓名='" & Combo1.Text & "'"
'con.Execute SQL
'MsgBox "系统接受了你的新密码。"
'Else
'MsgBox "输入的俩次密码不一致,请重新输入", , "系统提示!"
'Text1.Text = ""
'Text2.Text = ""
'End If
Text2.Text = ""
Text4.Text = ""
Text1.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
con.ConnectionString = "provider=sqloledb;persist security info = false;user id=sa;password=;initial catalog=company;data source=WGH"
con.Open
Set rs = New ADODB.Recordset
str = "select * from 操作用户"
rs.Open str, con, adOpenDynamic, adLockOptimistic
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -