检查ms访问数据库中的用户名和密码(checking username and password from a ms access database)

系统教程 行业动态 更新时间:2024-06-14 16:53:07
检查ms访问数据库中的用户名和密码(checking username and password from a ms access database)

我正在创建一个LMS。 它有一个部分从数据库检查用户名和密码并授予访问权限,但我不知道如何做到这一点。代码。

{ if (uname.Text == "" || pass.Text == "") { MessageBox.Show("Fields cannot be left blank."); } else { if (uname.Text != "member") { MessageBox.Show("Username Incorrect."); } else if (pass.Text != "member") { MessageBox.Show("Password Incorrect"); } else { Form3 frm = new Form3(); frm.Show(); }

现在我需要将“member”更改为我在密码数据库中输入的值。这是数据库成功链接的数据库

我如何进行读取,如果“我的数据库中的用户名”== myusername和密码相同?

I'm creating a LMS. It has a part which checks the username and password from the database and grants access but i dont know how to do that.here is the code.

{ if (uname.Text == "" || pass.Text == "") { MessageBox.Show("Fields cannot be left blank."); } else { if (uname.Text != "member") { MessageBox.Show("Username Incorrect."); } else if (pass.Text != "member") { MessageBox.Show("Password Incorrect"); } else { Form3 frm = new Form3(); frm.Show(); }

Now here i need to change "member" to the values that i have entered in the password database.Here is the database the database is successfully linked

how do i make read like if "username from my database"== myusername and same for password?

最满意答案

你可以把这样的查询

Select * from passdb where username=@user and password=@pass;

对于检查空字段,您可以放置​​验证器。

you can put query like this

Select * from passdb where username=@user and password=@pass;

for checking null fields you can put validators.

更多推荐

本文发布于:2023-04-05 21:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/73ed6740de39a3d674455f36bbadd8b2.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库中   用户名   密码   ms   checking

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!