C#SQL数据库窗体登录系统 [英] C# SQL Database Windows Form Login System

查看:285
本文介绍了C#SQL数据库窗体登录系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中的SQL数据库项目。我正在寻找创建一个登录表单,当有人启动应用程序时会出现。

Im working on a SQL database project in C#. I'm looking to create a login form which will be presented when someone starts the application.

连接到数据库,但是他们必须输入正确的用户名和

The connection is made to the database, however they must enter a correct username and password into the first form before they can proceed to see the rest.

我已经创建了两个文本框,一个按钮txtusername和txtpassword以及一个按钮登录。

I have created 2 text boxes, and a button txtusername and txtpassword and a button login.

这是我的SQL命令:

SqlCommand command = new SqlCommand("SELECT * FROM tblUsers WHERE Username ='" + txtUsername + "' AND Password = '" + txtPassword + "'", Program.cs);

我正在寻找一种方法显示在标签中,如果sql命令产生的结果意味着用户名和密码存储在用户表中,然后它返回true或某事。如果有一个更有效或更有效的方法,也让我知道:)

I'm looking for a way to show in a label if the sql command yields a result meaning the username and password is stored in the user table then it returns true or something. If there is a more efficient or effective way to this also let me know :).

推荐答案

此代码是一个漏洞project
查看详情

This code is a Vulnerability in your project See this for details

这篇关于C#SQL数据库窗体登录系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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