各位大哥帮帮手啊.我用VB做个系统,但用户密码修改这个窗体的代码老不会编啊,我在网上找了一些,但只有"输入新密码和确认密码"这两项,我想加多一项,请输入旧密码,但就是不知道怎么改啊.我用的是Adodc1.具体代码如下
Option Explicit
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
'检查各文本框是否为空
If Trim$(txtpassword1.Text) = "" Then
MsgBox "请输入新密码!", vbExclamation
txtpassword1.SetFocus
Exit Sub
End If
If Trim$(txtpassword2.Text) = "" Then
MsgBox "请确认新密码!", vbExclamation
txtpassword1.SetFocus
Exit Sub
End If
'检查两次输入密码是否相同
If Trim$(txtpassword1.Text) <> Trim$(txtpassword2.Text) Then
MsgBox "确认密码错误,请重新输入!", vbExclamation
With txtpassword2
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
With Adodc1
.RecordSource = "select * from 用户 where 用户名='" & gstruser & "'"
.Refresh
.Recordset("密码") = txtpassword1.Text
.Recordset.Update
End With
MsgBox "密码修改成功!", vbInformation
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
MDIForm1.Show
End Sub
Private Sub Label1_Click()
End Sub