?? changepswd.frm
字號:
VERSION 5.00
Begin VB.Form changepswd
BorderStyle = 3 'Fixed Dialog
Caption = "修改密碼"
ClientHeight = 2520
ClientLeft = 45
ClientTop = 330
ClientWidth = 4980
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2520
ScaleWidth = 4980
ShowInTaskbar = 0 'False
Begin VB.PictureBox Picture1
BackColor = &H00C0C0C0&
Height = 2265
Left = 120
ScaleHeight = 2205
ScaleWidth = 4665
TabIndex = 0
Top = 90
Width = 4725
Begin VB.TextBox txtold
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 1
Top = 240
Width = 1635
End
Begin VB.TextBox txtnew
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 2
Top = 840
Width = 1635
End
Begin VB.TextBox txtsec
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 3
Top = 1320
Width = 1635
End
Begin VB.CommandButton Command1
Caption = "確定"
Default = -1 'True
Height = 435
Left = 3480
TabIndex = 4
Top = 930
Width = 945
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "退出"
Height = 435
Left = 3510
TabIndex = 5
Top = 1470
Width = 945
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "舊 密 碼"
BeginProperty Font
Name = "楷體_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 120
TabIndex = 8
Top = 240
Width = 915
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "新 密 碼"
BeginProperty Font
Name = "楷體_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 150
TabIndex = 7
Top = 840
Width = 915
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "確定密碼"
BeginProperty Font
Name = "楷體_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 120
TabIndex = 6
Top = 1440
Width = 900
End
End
End
Attribute VB_Name = "changepswd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Dim rs As ADODB.Recordset
Dim oldpassword As String '該變量用來存放獲取的密碼
Dim cn As ADODB.Connection
Dim oldflag As String
Private Sub Combo1_Click()
txtold.SetFocus
End Sub
Function CheckString(s) As String
Dim pos As Integer
pos = InStr(1, s, "'")
While pos > 0
s = Mid(s, 1, pos) & "'" & Mid(s, pos + 1)
pos = InStr(pos + 2, s, "'")
Wend
CheckString = "'" & s & "'"
End Function
'*********修改密碼*********
Private Sub Command1_Click()
Dim name As String
Dim rs As ADODB.Recordset
Dim strsql
Dim t As VbMsgBoxResult
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
strsql = "select * from user_load where user_name=" & Me.CheckString(username)
rs.open strsql
oldpassword = rs.Fields("password") '獲取密碼'核對密碼
name = rs.Fields("user_name")
If txtold.Text = oldpassword Then
If txtnew.Text = txtsec.Text Then
If txtnew.Text = "" Or txtsec.Text = "" Then
t = MsgBox("請輸入密碼!", 48, "WARNING")
Else '如滿足條件,則更新密碼
rs.Fields("password") = txtnew.Text '是否有問題 ??
rs.Update
t = MsgBox("密碼修改成功!", vbOKOnly, "SURE")
txtold.Text = ""
txtnew.Text = ""
txtsec.Text = ""
End If
Else
t = MsgBox("密碼輸入不同!", 48, "warning")
txtnew.Text = ""
txtsec.Text = ""
End If
Else
t = MsgBox("原密碼錯(cuò)誤!", 48, "warning")
txtold.Text = ""
txtnew.Text = ""
txtsec.Text = ""
End If
End Sub
Private Sub Command2_Click()
If cn.State = 1 Then cn.close
Unload Me
End Sub
Private Sub Form_Load()
MyMenu = GetSystemMenu(Me.hwnd, 0) '得到系統(tǒng)菜單的句柄,Me.hwnd表示當(dāng)前窗體的句柄
RemoveMenu MyMenu, &HF060, MF_BYCOMMAND '移去“關(guān)閉”菜單項(xiàng),&HF060“關(guān)閉”菜單項(xiàng)的命令I(lǐng)D
Set cn = New ADODB.Connection
'cn.Provider = "sqloledb"
'cn.Properties("Data Source").Value = "JIMMY" '建立與本地?cái)?shù)據(jù)庫的連接
'cn.Properties("Initial Catalog").Value = "YAOFEI" '數(shù)據(jù)庫的名稱
'cn.Properties("Integrated Security").Value = "SSPI"
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data source =" & App.Path & "/data/goodStock.mdb" '我轉(zhuǎn)換的access數(shù)據(jù)庫路徑
cn.open
End Sub
Private Sub Form_Unload(Cancel As Integer)
MainForm.StatusBar1.Panels(1).Text = "狀態(tài): 無"
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -