通过C#中的访问数据库对用户进行授权 [英] Authorization of user from access data base in C#

查看:148
本文介绍了通过C#中的访问数据库对用户进行授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


这是问题所在

我正在为此用C#创建桌面应用程序,我需要从具有用户名的数据库中进行身份验证,并且要检查此用户是否存在于访问数据库中,或者如果该用户不存在,请从数据库中返回用户ID. div class ="h2_lin">解决方案

检查以下线程中的示例:
http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/thread/21f08279-d1ac-4567-8eeb-bcd48e666564 [ SQL教程 [^ ].并取决于您如何构建包含用户信息的表. SELECT语句可以有所不同.

一个例子可以是:

 选择 id  FROM 用户访问权限在哪里 login = '  kim' > AND  SHA1(password)= SHA1('  mypass')



如果登录名和密码都为登录名,将给出1个结果.
请参见密码存储:操作方法. [ ^ ]


Hi
Here is the problem

I am creating desktop application in C# for this I need authentication from data base where I have user name and I want to check that wether this user exist in access data base or no if the user exist there return the user id from data base.

解决方案

check the examples in following thread:
http://social.msdn.microsoft.com/Forums/en/winformsdatacontrols/thread/21f08279-d1ac-4567-8eeb-bcd48e666564[^]


Start out with SQL Tutorial[^]. And depend on how you build up the table that holds the user info. SELECT statement can vary.

One example can be:

SELECT id FROM useraccess WHERE login='kim' AND SHA1(password)=SHA1('mypass')



It will give 1 result, if login and password macth login.
Please see this great tip Password Storage: How to do it.[^]


这篇关于通过C#中的访问数据库对用户进行授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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