首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

VB 登录验证有关问题

2013-04-20 
VB 登录验证问题本帖最后由 bcrun 于 2013-04-11 09:44:41 编辑Private Sub cmdOk_Click()登录If Trim(Me

VB 登录验证问题
本帖最后由 bcrun 于 2013-04-11 09:44:41 编辑

Private Sub cmdOk_Click()
'登录
If Trim(Me.txtName.Text) <> "" Then
    Sql = "select 密码 from 密码表 where 用户名='" & Trim(Me.txtName.Text)
    Sql = Sql & "' and 类型='" & Trim(Me.cboType.Text) & "'"
    Set RS = dbSelect(Sql)
    If RS.EOF And RS.BOF Then
        MsgBox "无此用户!"
    Else
        If Me.txtPwd.Text = RS.Fields(0) Then
            mdiMain.Show
            If Me.cboType.Text = "管理员" Then
                mdiMain.mnuSysSetUser.Visible = False
                mdiMain.mnuSysDelUser.Visible = False
            ElseIf Me.cboType.Text = "销售员" Then
                mdiMain.mnuSysSetUser.Visible = False
                mdiMain.mnuSysDelUser.Visible = False
                mdiMain.mnuCheck.Visible = False
                mdiMain.mnuReport.Visible = False
                mdiMain.mnuSellReport.Visible = False
                mdiMain.mnuSellDay.Visible = False
                mdiMain.mnuSellCheck.Visible = False
                mdiMain.mnuOther.Visible = False
            Else
                mdiMain.mnuReportUser.Visible = True
            End If
            mdiMain.Caption = "销售系统 " & "(当前用户:" & Format(Trim(Me.cboType.Text), "#####") & "  " & Trim(Me.txtName.Text) & ")"
            mdiMain.Tag = Trim(Me.txtName.Text)
            Unload Me
        Else
            MsgBox "密码或者用户名不正确!"
            Me.txtName.SetFocus
        End If
    End If
Else
    MsgBox "用户名不能为空!"
    Me.txtName.SetFocus
End If

End Sub
 


[解决办法]
If Me.txtPwd.Text = RS.Fields(0) Then 这里打一个断点,看看 txtPwd 和 RS.Fields(0) 的内容。

热点排行