点击登录按钮Button时
protected void denglu_Click(object sender, EventArgs e)
{
SqlConnection cn = conn.CreateConnection();
SqlCommand com = new SqlCommand();
com.Connection = cn;
cn.Open();
com.CommandText = "select count(*) from [Members] where [UserName]='" + this.username.Text + "' and [Password]='"+this.password.Text+"'";//数据库中username每个用户的都不一样,确定是否符合用户要求
int a = Convert.ToInt32(com.ExecuteScalar());
if (a>0)
{
Session["UserName"] = this.username.Text;
Session["PassWord"] = this.password.Text;
Response.Write("<script> alert( '欢迎您登录! ');location='/resdc/Default.aspx' </script>");
//Panel1.Visible = false;//登录框界面