如何从数据库中检查loginID和密码 [英] how to check the loginID and password from the database

查看:78
本文介绍了如何从数据库中检查loginID和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从数据库访问用户名和密码以检查其有效性.因此,无论是在前端还是后端,如何访问或如何检查它,我都必须编写该过程.如果我编写该程序如何返回结果.

i was trying to access username and password from database to check validity of it. so how to access or how to check it whether at frontend or at backend i have to write the procedure. if i write the procedure how to return the results.

推荐答案

您好.我更喜欢从存储过程中返回数字.

例如:


Hello. I prefer to return numbers from Stored Procedure.

For example:


Declare @Count  As bigint

    Set  @Count =    (Select Count(UserName) From    [User]
            Where [USER].UserName = @UserName And   [User].[Password] = @Password )
    if @Count >0 return 1



然后我将值重新设置为1,这表示身份验证正常.



then I retuned value is 1, it means the authentication is ok.


此处有一些有关密码存储的说明:
There are some notes on password storage here: Password Storage: How to do it.[^]


这篇关于如何从数据库中检查loginID和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆