📄 frm_mmxg.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_mmxg
BorderStyle = 1 'Fixed Single
Caption = "更改密码"
ClientHeight = 2250
ClientLeft = 45
ClientTop = 330
ClientWidth = 5100
Icon = "frm_mmxg.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2250
ScaleWidth = 5100
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CmdEXTI
Caption = "退出 (&E)"
Height = 375
Left = 3810
TabIndex = 11
Top = 1695
Width = 1155
End
Begin VB.CommandButton Command1
Caption = "更改 (&U)"
Height = 375
Left = 3810
TabIndex = 12
Top = 1335
Width = 1155
End
Begin VB.Frame Frame2
ForeColor = &H80000002&
Height = 2010
Left = 75
TabIndex = 0
Top = 60
Width = 3600
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 420
Top = 225
Visible = 0 'False
Width = 1410
_ExtentX = 2487
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=company"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=company"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from 操作用户"
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.TextBox Text4
Height = 300
IMEMode = 3 'DISABLE
Left = 1965
PasswordChar = "*"
TabIndex = 6
Top = 1545
Width = 1455
End
Begin VB.TextBox Text3
Height = 285
Left = 2640
TabIndex = 5
Top = 135
Visible = 0 'False
Width = 855
End
Begin VB.TextBox Text2
Height = 300
IMEMode = 3 'DISABLE
Left = 1965
PasswordChar = "*"
TabIndex = 4
Top = 1230
Width = 1455
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frm_mmxg.frx":0442
Left = 1965
List = "frm_mmxg.frx":0444
TabIndex = 3
Top = 510
Width = 1455
End
Begin VB.TextBox Text1
Height = 300
IMEMode = 3 'DISABLE
Left = 1965
PasswordChar = "*"
TabIndex = 2
Top = 870
Width = 1455
End
Begin VB.TextBox tName
Height = 270
Left = 2820
TabIndex = 1
Text = "Text8"
Top = 150
Visible = 0 'False
Width = 675
End
Begin VB.Label Label4
Caption = "确认密码:"
Height = 255
Left = 480
TabIndex = 10
Top = 1620
Width = 1575
End
Begin VB.Label Label3
Caption = "新密码:"
Height = 255
Left = 495
TabIndex = 9
Top = 1305
Width = 1575
End
Begin VB.Label Label2
Caption = "旧密码:"
Height = 255
Left = 495
TabIndex = 8
Top = 960
Width = 1575
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 255
Left = 495
TabIndex = 7
Top = 615
Width = 1575
End
End
End
Attribute VB_Name = "frm_mmxg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private con1 As New ADODB.Connection
Private rs1 As New ADODB.Recordset
Private Sub CmdEXTI_Click()
Unload Me
End Sub
Private Sub Combo1_Click()
tName.Text = Combo1.Text
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text1.SetFocus
End Sub
Private Sub Command1_Click()
Set con1 = New ADODB.Connection
con1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=company"
con1.Open
Set rs1 = New ADODB.Recordset
If Combo1.Text = "" Then
MsgBox "请选择你要修改的用户名!", , "系统提示"
Combo1.SetFocus
Exit Sub
End If
If Combo1.Text = tName.Text Then
str1 = "select * from 操作用户 where 姓名='" & Combo1.Text & "'"
Set rs1 = con1.Execute(str1)
On Error Resume Next
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 & "'"
con1.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
Text2.Text = ""
Text4.Text = ""
Text1.Text = ""
End Sub
Private Sub Form_Load()
Adodc1.RecordSource = "select * from 操作用户"
Adodc1.Refresh
For i = 0 To Adodc1.Recordset.RecordCount - 1 '动态装载数据库里的用户名
Combo1.AddItem Adodc1.Recordset.Fields("姓名").Value
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Exit For
Next
Combo1.Refresh
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text4.SetFocus
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -