C# 验证登录错误

C# 验证登录错误,c#,login,C#,Login,我正在使用以下C#代码登录页面,但我收到一个错误,上面写着: “请确保用户名和密码正确” 请告诉我上面的代码有什么问题,这很简单: if (txtUsername.Text != string.Empty && txtPassword.Text != string.Empty) 此行返回false,因此执行else,即: else { lblMessage.Text = "Please make sure that the username and the passwo

我正在使用以下C#代码登录页面,但我收到一个错误,上面写着:

“请确保用户名和密码正确”


请告诉我上面的代码有什么问题,这很简单:

if (txtUsername.Text != string.Empty && txtPassword.Text != string.Empty)
此行返回false,因此执行
else
,即:

else
{
    lblMessage.Text = "Please make sure that the username and the password is Correct";
}

调试代码。

好,如果
txtstername
和/或
txtsterpassword
等于
字符串,则会显示该消息。空的
仅供参考在数据库中以纯文本形式存储用户密码是个坏主意。我知道,但是不能加密它们。有什么线索吗?可能的问题是,您的用户名和密码与数据库不匹配。瞧!,输入正确和准确的一个。这应该会有帮助,因为他们是绝对正确的
else
{
    lblMessage.Text = "Please make sure that the username and the password is Correct";
}