数据库名是User 表名是Login 然后下面这个登陆页面验证怎么总报错呢?求解答,在线等呀
protected void btnEnter_Click(object sender, EventArgs e)
{
protected void btnEnter_Click(object sender, EventArgs e)
{
string UserName = this.UserName.Text.Trim();
string PassWord = this.PassWord.Text.Trim();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[“ConStr”].ConnectionString);
con.Open();
SqlCommand SqlComm = new SqlCommand(“select * from Login where UserName = @UserName and PassWord = @PassWord “);
//SqlComm.CommandText = “select * from Login where UserName = @UserName and PassWord = @PassWord “;
SqlDataReader thisReader = SqlComm.ExecuteReader();
if (thisReader.Read())
{
if (thisReader[“UserName”].ToString().Trim() == PassWord)
{
}
else
{
}
}
}
}