标题:求教 登陆条件解析
取消只看楼主
luke0718
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-11-24
结帖率:50%
已结贴  问题点数:16 回复次数:0 
求教 登陆条件解析
if((textBox1.Text=="")||(textBox2.Text==""))
{
MessageBox.Show(this,"请从新输入用户名和密码!","信息提示",
MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
SqlConnection con=DB.CreateConn();
con.Open();
SqlCommand cmd=new SqlCommand("select count(*) from login where ID='"+textBox1.Text+"'",con);
int count1=Convert.ToInt32(cmd.ExecuteScalar());
if(count1<=0)
{
  this.errorProvider1.SetError(this.textBox1,"用户名输入错误");
}
  SqlCommand cmd1=new SqlCommand("select count(*) from login where pwd='"+textBox2.Text+"'",con);
int count2=Convert.ToInt32(cmd1.ExecuteScalar());
int count3=count1+count2;
if(count3<=count1||count3<=count2)
{
this.errorProvider1.SetError(this.textBox2,"密码输入错误");
DialogResult drt=MessageBox.Show("用户名密码错误,是否重新输入?","提示信息",MessageBoxButtons.RetryCancel,MessageBoxIcon.Question);
switch(drt)
{
case DialogResult.Retry:
textBox1.Text="";
textBox2.Text="";
break;
case DialogResult.Cancel:
break;   
}


  请求高手能解释红色部分的意思!谢谢!
搜索更多相关主题的帖子: 登陆 解析 条件 
2010-12-16 22:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-329168-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014773 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved