?? frmuserupdate.frm
字號:
VERSION 5.00
Begin VB.Form frmUserUpdate
Caption = "修改用戶"
ClientHeight = 4680
ClientLeft = 4605
ClientTop = 3360
ClientWidth = 5460
LinkTopic = "Form4"
ScaleHeight = 4680
ScaleWidth = 5460
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 2760
TabIndex = 9
Top = 3840
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "確定"
Height = 495
Left = 840
TabIndex = 8
Top = 3840
Width = 1335
End
Begin VB.TextBox txtOldPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 7
Top = 1320
Width = 1575
End
Begin VB.TextBox txtNewPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 6
Top = 2160
Width = 1575
End
Begin VB.TextBox txtPasswordConfirm
Height = 375
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 5
Top = 3000
Width = 1575
End
Begin VB.TextBox txtName
Height = 375
Left = 2640
TabIndex = 4
Top = 480
Width = 1575
End
Begin VB.Label Label4
Caption = "原密碼"
Height = 375
Left = 720
TabIndex = 3
Top = 1320
Width = 1335
End
Begin VB.Label Label3
Caption = "新密碼"
Height = 375
Left = 720
TabIndex = 2
Top = 2160
Width = 1335
End
Begin VB.Label Label2
Caption = "確認新密碼"
Height = 375
Left = 720
TabIndex = 1
Top = 3000
Width = 1335
End
Begin VB.Label Label1
Caption = "用戶名"
Height = 375
Left = 720
TabIndex = 0
Top = 480
Width = 1335
End
End
Attribute VB_Name = "frmUserUpdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim N As Boolean
N = True
If Trim(txtName.Text) = "" Then
MsgBox "用戶名不能為空", vbOKOnly + vbExclamation, ""
txtName.SetFocus
N = False
End If
If Trim(txtOldPassword.Text) = "" Then
MsgBox "原密碼不能為空", vbOKOnly + vbExclamation, ""
txtOldPassword.SetFocus
N = False
End If
If N = True Then
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=book.mdb;Persist Security Info=False"
conn.Open
sql = "select*from UserInfo where Username = '"
sql = sql + txtName.Text + "' and Password='" + txtOldPassword.Text + "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
MsgBox "用戶名或口令錯誤,請檢查!"
N = False
ElseIf N = True Then
If Trim(txtNewPassword.Text) = "" Then
MsgBox "新密碼不能為空", vbOKOnly + vbExclamation, ""
txtNewPassword.SetFocus
N = False
End If
If Trim(txtNewPassword.Text <> txtPasswordConfirm) Then
MsgBox "新密碼不一致", vbOKOnly + vbExclamation, ""
txtNewPassword.Text = ""
txtPasswordConfirm.Text = ""
N = False
End If
rs.Close
End If
If N = True Then
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
rs.Fields(2) = txtNewPassword.Text
rs.Update
rs.Close
MsgBox "修改用戶成功!"
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -