VB+SQL书店图书管理系统(任务书+开题报告+论文) 第15页

VB+SQL书店图书管理系统(任务书+开题报告+论文) 第15页
模块名:CmdChgPass_Click
模块原型:Private Sub CmdChgPass_Click()
代码:
Private Sub CmdChgPass_Click()
On Error GoTo errEnd

If TxtUserID.Text = "" Then
    MsgBox "请输入你的帐号!", vbOKOnly + vbExclamation, "更改密码"
    TxtUserID.SetFocus
    Exit Sub
End If
If TxtPasswd.Text = "" Then
    MsgBox "请输入你的旧密码!", vbOKOnly + vbExclamation, "更改密码"
    TxtPasswd.SetFocus
    Exit Sub
End If
If TxtNewPasswd.Text = "" Then
    MsgBox "请输入你的新密码!", vbOKOnly + vbExclamation, "更改密码"
    TxtNewPasswd.SetFocus
    Exit Sub
End If
If TxtNewPasswd.Text <> TxtNewPasswdC.Text Then
    MsgBox "密码输入不一致,请重试!", vbOKOnly + vbExclamation, "更改密码"
    TxtPasswd.Text = ""
    TxtNewPasswd.Text = ""
    TxtNewPasswdC.Text = ""
    TxtPasswd.SetFocus
    Exit Sub
End If

If checkUserID(TxtUserID.Text) Then
   
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from [Admin] where [用户密码]=""" & TxtPasswd.Text & """ and [用户ID]=""" & TxtUserID.Text & """"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Adodc1.Recordset.MoveFirst
        Adodc1.Recordset!用户密码 = TxtNewPasswd.Text
        Adodc1.Recordset.Update
    Else
        MsgBox "用户密码验证错误!你无权修改密码!", vbOKOnly + vbExclamation, "密码错误"
        TxtPasswd.Text = ""
        TxtNewPasswd.Text = ""
        TxtNewPasswdC.Text = ""
        Exit Sub
    End If
   
    MsgBox "用户密码修改成功!请牢记!", vbOKOnly + vbInformation, "更改密码"
    TxtPasswd.Text = ""
    TxtNewPasswd.Text = ""
    TxtNewPasswdC.Text = ""
Else
    MsgBox "该用户不存在!无法修改密码!", vbOKOnly + vbExclamation, "更改密码"
    TxtPasswd.Text = ""
    TxtNewPasswd.Text = ""
    TxtNewPasswdC.Text = ""
End If

Exit Sub

errEnd:
    MsgBox Err.Description & vbCrLf & "更改密码失败!", vbOKOnly + vbExclamation, "操作数据库出错"
End Sub

模块名:CmdRegMe_Click
模块原型:Private Sub CmdRegMe_Click()
代码:
Private Sub CmdRegMe_Click()
On Error GoTo errEnd

If TxtCard.Text = "" Then
    MsgBox "请填写员工帐号!", vbOKOnly + vbExclamation, "创建员工帐号"
    TxtCard.SetFocus
    Exit Sub
End If
If TxtUName.Text = "" Then
    MsgBox "请填写员工的姓名!", vbOKOnly + vbExclamation, "创建员工帐号"
    TxtUName.SetFocus
    Exit Sub
End If
If ComboShenFen.Text = "" Or ComboShenFen.Text = "请选择员工身份" Then
    MsgBox "请选择员工的身份!", vbOKOnly + vbExclamation, "创建员工帐号"
    ComboShenFen.SetFocus
    Exit Sub
End If
If TxtUDanWei.Text = "" Then TxtUDanWei.Text = "无"

If TxtUDiZhi.Text = "" Then
    MsgBox "请填写员工的地址!", vbOKOnly + vbExclamation, "创建员工帐号"
    TxtUDiZhi.SetFocus
    Exit Sub
End If
If TxtUMail.Text = "" Then TxtUMail.Text = "无"
If TxtUDianHua.Text = "" Then TxtUDianHua.Text = "无"
If TxtUMemo.Text = "" Then TxtUMemo.Text = "无"

If checkUserID(TxtCard.Text) Then
    MsgBox "这个员工帐号已经被注册!请另选一个!", vbOKOnly + vbExclamation, "创建员工帐号"
    TxtCard.SelStart = 0
    TxtCard.SelLength = Len(TxtCard.Text)
    TxtCard.SetFocus
    Exit Sub
End If
CmdRegMe.Enabled = False
‘开始一个事务
BeginTrans

Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "员工表"
Adodc1.Refresh

Adodc1.Recordset.AddNew
Adodc1.Recordset!员工帐号 = TxtCard.Text

 << 上一页  [11] [12] [13] [14] [15] [16] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有