c 验证用户名和密码c 验证用户名和密码
er;Integrated Security=sspi&uot;;
SlConnection con = new SlConnection(testConnectionstring);
string sl = &uot;select Name,Password,Cname from user&uot;;
SlCommand com = new SlCommand(sl, con);
SlDataAdapter da = new SlDataAdapter();
da.SelectCommand...
c 验证用户名和密码
er;Integrated Security=sspi&uot;;
SlConnection con = new SlConnection(testConnectionstring);
string sl = &uot;select Name,Password,Cname from user&uot;;
SlCommand com = new SlCommand(sl, con);
SlDataAdapter da = new SlDataAdapter();
da.SelectCommand = com;
con.Open();
DataSet ds = new DataSet();
da.Fill(ds, &uot;user&uot;);
DataRow nameRow;
if (comboBox1.Text != &uot;&uot;)
{
if (textBox1.Text != &uot;&uot;)
{
for (int i = 0; i < ds.Tables[&uot;user&uot;].Rows.Count; i++)
{
nameRow = ds.Tables[&uot;user&uot;].Rows[i];
if (nameRow[0].ToString().Trim() == comboBox1.Text.ToString().Trim() &&
nameRow[1].ToString().Trim() == textBox1.Text.ToString().Trim())
{
string slaaa = &uot;update user set state='在线' where name='&uot; + comboBox1.Text + &uot;'&uot;;
SlCommand comaaa = new SlCommand(slaaa, con);
comaaa.ExecuteNonuery();
//数据修改
Form2 main = new Form2();
main.lb.Text=this.comboBox1.Text.ToString();
main.lbname.Text = nameRow[2].ToString(); ;
main.Show();
main.Text = &uot;欢迎你:&uot; + nameRow[2].ToString();//把数据库里的数据提取出来
main.name.Text = nameRow[2].ToString();
main.notifyIcon1.Text = nameRow[2].ToString() + this.comboBox1.Text;
con.Close();
main.Show();
this.Hide();
return;
}
}
con.Close();
//MessageBox.Show(&uot;用户名或密码不正确&uot;);
if (MessageBox.Show(&uot;用户名或密码不正确&uot;,&uot;错误
&uot;,MessageBoxButtons.OK,MessageBoxIcon.Error ) == DialogResult.OK)
{
textBox1.Text = &uot;&uot;;
}
}
else MessageBox.Show(&uot;请输入密码~&uot;);
}
else MessageBox
本文档为【c 验证用户名和密码】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。