问大家一个关于登陆的问题那。
private void wuzhonghao(string username, string pwd)
{
try
{
SqlConnection con = xzyywuliu.DB.createCon();
con.Open();
SqlCommand com = new SqlCommand( "select userName,userPwd,IDCard from xzcx_login where userName= ' " + username + " ' and userPwd= ' " + pwd + " ' ", con);
SqlDataReader reader = com.ExecuteReader();
if (!reader.HasRows)
{
this.Label1.Text = "用户名错误 ";
}
else
{
while (reader.Read())
{
if (pwd != reader.GetString(1))
{
this.Label1.Text = "密码错误 ";
}
else
{
this.Panel2.Visible = true;
this.Panel1.Visible = false;
Session[ "user "] = reader[ "userName "];