📄 setpass.frm
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SmartXPButton.ocx"
Begin VB.Form setpass
BackColor = &H00E7DFE7&
Caption = "修改密码"
ClientHeight = 3780
ClientLeft = 60
ClientTop = 450
ClientWidth = 5580
Icon = "setpass.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3780
ScaleWidth = 5580
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Left = 3000
PasswordChar = "*"
TabIndex = 0
Top = 1320
Width = 1575
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 3000
PasswordChar = "*"
TabIndex = 1
Top = 2160
Width = 1575
End
Begin SmartXPButton.XpButton cmdcancel
Height = 495
Left = 3000
TabIndex = 2
Top = 3000
Width = 1815
_ExtentX = 3201
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "取消(&C)"
PictureSmoothBackColor= 15460844
ButtonPicture = "setpass.frx":0A02
End
Begin SmartXPButton.XpButton cmdok
Height = 495
Left = 720
TabIndex = 3
Top = 3000
Width = 1695
_ExtentX = 2990
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "确定(&O)"
PictureSmoothBackColor= 15460844
ButtonPicture = "setpass.frx":1414
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "确认密码:"
Height = 255
Left = 2085
TabIndex = 6
Top = 2280
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "密码设置"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000002&
Height = 495
Left = 1920
TabIndex = 5
Top = 120
Width = 2055
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "新密码(&P):"
Height = 495
Left = 2040
TabIndex = 4
Top = 1440
Width = 975
End
Begin VB.Image Image1
Height = 1740
Left = 360
Picture = "setpass.frx":1E26
Top = 840
Width = 1380
End
End
Attribute VB_Name = "setpass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim myconn As New ADODB.Connection
Dim str As String
Dim MyStr As String
Dim MyRs As New ADODB.Recordset
Private Sub cmdcancel_Click()
MyRs.Close
myconn.Close
Unload Me
End Sub
Private Sub cmdok_Click()
Dim varmark As Variant
If Len(Trim(Text1.Text)) > 10 Or Len(Trim(Text2.Text)) > 15 Then
MsgBox "密码太长!", vbOKOnly + vbExclamation, "错误信息"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Exit Sub
End If
With MyRs
varmark = .Bookmark
.Find "username=" & Trim(dluser)
If .EOF Then
.Bookmark = varmark
Else
If Trim(Text1.Text) = Trim(Text2.Text) Then
.Fields("password") = Trim(Text1.Text)
If MsgBox("保存修改结果吗?", vbYesNo) = vbYes Then
.Update
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
.CancelUpdate
End If
Else
MsgBox "两次输入的密码不一致,请重新输入密码!", vbOKOnly + vbExclamation, "错误提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End If
End With
End Sub
Private Sub Form_Load()
Set myconn = New ADODB.Connection
myconn.ConnectionString = "driver={SQL Server};" & _
"server=(local);uid=sa;pwd=;database=student_info"
myconn.Open
'***** 使用Recordset对象的Open方法创建记录集 *****
'MyRs.Open "manager", MyConn, adOpenStatic, adLockOptimistic, adCmdTable
Set MyRs = New ADODB.Recordset
With MyRs
.Source = "manager"
.ActiveConnection = myconn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open , , , , adCmdTable
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -