Exemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        SQlHelper db  = new SQlHelper();
        string    sql = "select apo,name from userInfo";
        DataTable dt  = db.ExcuteQuery("SqlServer", sql);;

        for (int i = 0; i < dt.Rows.Count - 1; i++)
        {
            string a = dt.Rows[i][0].ToString();
            string b = dt.Rows[i][1].ToString();
            if (TextBox1.Text == a && TextBox2.Text == b)
            {
                Label1.Text = "登录成功";
                Server.Transfer("default.aspx");
            }
            else
            {
                Label1.Text = "登录失败";
            }
        }
    }