用c# 代码编写简单的用户登录界面

来源:百度知道 编辑:UC知道 时间:2024/06/23 18:19:06
用c# 代码编写简单的用户登录界面,实现根据输入的用户名和密码,到数据库搜索匹配的用户名和密码(数据库建有的表),如果找到就登录到另一个界面。。。。有谁能帮一下谢了

private void btnLogin_Click(object sender, EventArgs e)
{
string str = "";
string str2 = "";
if (StringType.StrCmp(this.cboUserName.Text, "", false) == 0)
{
OMISFunction.MessageboxInfo("请选择要登录的用户名 !", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
this.cboUserName.Focus();
return;
}
else
{
str3 = Strings.Mid(this.cboUserName.Text, Strings.InStr(this.cboUserName.Text, "=", CompareMethod.Text) + 1);
str = Strings.Trim(Strings.Mid(this.cboUserName.Text, 1, Strings.InStr(this.cboUserName.Text, "=", CompareMethod.Text) - 1));
string strSql = "select ID from view_user where ID= " + str3;
try
{
//这里省略