string strSql = "select username,userpassword from employees where username ='" + tbName.text + "'";
SqlConnection conn = new SqlConnection("连接字符串");
SqlCommand comm = new SqlCommand (strSql,conn);
conn.Open();
SqlDataReader reader = comm.ExecuteReader();
reader.Read();
if (reader[0] != null)
if (reader[0].ToString().Trim().Equals(tbPassword.Text.Trim()))
登陆;
else
提示密码错误;
else
提示没有此用户
reader.Close();
conn.Close();
登录用户名和密码的验证
最新推荐文章于 2023-05-08 21:20:34 发布