protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("server=.;pwd=sa;uid=sa;database=PetShopping");
        con.Open();
        SqlCommand cmd = new SqlCommand("select Count(*) from users where usersName='"+this.TextBox1.Text.ToString()+"'and usersPassword='"+this.TextBox2.Text.ToString()+"'", con);
        int count =  Convert .ToInt32(cmd.ExecuteScalar());
        if (count > 0)
        {
            Session["usersName"] = this.TextBox1.Text.ToString();
            Response.Redirect("Default1.aspx");
            
        }
        else
        {
            Response.Write("<script>alert('用户名或密码错误')</script>");
            this.Response.Redirect("login.aspx") ;
        }
        con.Close();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("server=.;pwd=sa;uid=sa;database=PetShopping");
        con.Open();
        SqlCommand cmd = new SqlCommand("select Count(*) from manager where managerName='" + this.TextBox3.Text.ToString() + "'and managerPassword='" + this.TextBox4.Text.ToString() + "'", con);
        int count = Convert.ToInt32(cmd.ExecuteScalar());
        if (count > 0)
        {
            Session["usersName"] = this.TextBox3.Text.ToString();
            Response.Redirect("houtaiguanli/Default.aspx");        }
        else
        {
            Response.Write("<script>alert('用户名或密码错误')</script>");
            this.Response.Redirect("login.aspx");
        }
        con.Close();
    }
    protected void TextBox4_TextChanged(object sender, EventArgs e)
    {    }

解决方案 »

  1.   

    <asp:TextBox runat="server"  TextMode="Password">
      

  2.   

    TextBox属性,TextMode设为password
      

  3.   

    this.TextBox4.TextMode  = TextBoxMode.Password;
      

  4.   

    <asp:TextBox runat="server"  TextMode="Password">
      

  5.   

    直接拖进去一个textBox 然后把textbox的TextMode属性设置为password 就可以了
      

  6.   

    <asp:TextBox runat="server"  TextMode="Password">
      

  7.   

    TextBox中有一个属性TextMode,设为password即可!!!
      

  8.   


      up     也可以在属性栏中更改属性,建议LZ把控件的相关属性了解下,一般都有注释的。
      

  9.   

    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
    TextMode=“Password”
      

  10.   

    设置 TextMode 这个属性就可以了。
    默认是 SingleLine<asp:TextBox ID="txt密码" runat="server"  TextMode="Password"></asp:TextBox>
      

  11.   

    悲剧,只有我了解楼主啊,taxtmode=怕ssword后  密码是用小圆点表示的,不是*..
    本人同求解.
      

  12.   

    設置textbox屬性就可以咯 
      

  13.   

    在加一句PasswordChar = "*" 就可以了啊
      

  14.   

    <asp:TextBox runat="server"  TextMode="Password">