有更好的方法吗? [英] is there a better way for this?

查看:61
本文介绍了有更好的方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有更好的方法吗?

is there a better way for this?

IF((SELECT COUNT(*) FROM s_Users WHERE username=@username and password=@password)>0)
-- login


推荐答案

也可以对密码进行哈希处理.在数据库中以纯文本格式存储密码是一个坏主意:)
It might be useful to hash the password, too. Storing passwords in plaintext in the database is a bad idea :)


您尝试过此密码吗?

Have you tried this one?

IF EXISTS(SELECT 1 FROM s_Users WHERE username=@Username AND password=@Password)
BEGIN
  -- ACCEPT LOGIN
END
ELSE
  -- AUTHENTICATION FAILURE



问候,
爱德华



Regards,
Eduard


这篇关于有更好的方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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