📄 form14.frm
字号:
VERSION 5.00
Begin VB.Form Form14
BorderStyle = 4 'Fixed ToolWindow
Caption = "修改密码"
ClientHeight = 5415
ClientLeft = 45
ClientTop = 390
ClientWidth = 6375
LinkTopic = "Form14"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5415
ScaleWidth = 6375
ShowInTaskbar = 0 'False
Begin VB.TextBox Text4
Height = 615
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 9
Top = 960
Width = 1935
End
Begin VB.TextBox Text3
Height = 615
Left = 2280
TabIndex = 8
Top = 240
Width = 1935
End
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3600
TabIndex = 3
Top = 3960
Width = 975
End
Begin VB.CommandButton Command1
Caption = "确认"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 2
Top = 3960
Width = 975
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 1
Top = 2760
Width = 1935
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 0
Top = 1920
Width = 1935
End
Begin VB.Label Label4
Caption = "请输入原密码"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 7
Top = 1080
Width = 1575
End
Begin VB.Label Label3
Caption = "请输入用户名"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 6
Top = 360
Width = 1695
End
Begin VB.Label Label2
Caption = "请确认新密码"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 5
Top = 2880
Width = 1695
End
Begin VB.Label Label1
Caption = "请输入新密码"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 480
TabIndex = 4
Top = 2040
Width = 1695
End
End
Attribute VB_Name = "Form14"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim mrc As New ADODB.Recordset
Private Sub Command1_Click()
Dim txt As String
txt = "select * from 用户表 "
Set mrc = executesql(txt)
If Text3.Text = "" Or Text4.Text = "" Then
MsgBox "请输入密码和用户"
Exit Sub
End If
Do While (mrc.EOF = False And mrc.BOF = False)
If mrc.Fields(0) <> Text3.Text Or mrc.Fields(1) <> Text4.Text Then
mrc.MoveNext
Else
If mrc.Fields(0) = Text3.Text And mrc.Fields(1) = Text4.Text Then
Exit Do
End If
End If
Loop
If mrc.EOF = True Then
MsgBox "没有这个用户"
Exit Sub
End If
Dim txtsql As String
txtsql = "select * from 用户表 where 用户表.用户名= " & "'" & Text3.Text & "'"
Set mrc = executesql(txtsql)
If Trim(Text1.Text) <> Trim(Text2.Text) Then
MsgBox "两次输入密码不一样 请确认!", , "警告"
Exit Sub
Else
If Text2.Text = "" Then
MsgBox "密码不能为空!", vbExclamation, "警告"
Else
mrc.Fields(1).Value = Trim(Text1.Text)
mrc.Update
MsgBox "修改密码成功!", , "修改密码"
Me.Hide
End If
End If
End Sub
Public Function executesql(ByVal sql As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
Dim stokens() As String
stokens = Split(sql)
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
If InStr(" INSERT,DELETE,UPDATE", UCase$(stokens(0))) Then
cnn.Execute sql
Else
Set rst = New ADODB.Recordset
rst.Open Trim$(sql), cnn, adOpenKeyset, adLockOptimistic
Set executesql = rst
End If
End Function
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Form_Load()
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
conn.Open connstr
Text1.Text = ""
Text2.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -