示例#1
0
        public void  ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string    str  = context.Request["use"];
            string    str1 = context.Request["password"];
            DataTable ds   = Sqlhelper1.ExecuteDataTable("select * from student where id=@id and  keys=@keys", new SqlParameter("@id", str), new SqlParameter("@keys", str1));

            if (ds.Rows.Count == 1)
            {
                context.Response.Write("ok");
                foreach (DataRow row in ds.Rows)
                {
                    int    id      = (int)row["id"];
                    string keys    = (string)row["keys"];
                    string name    = (string)row["name"];
                    string xingbie = row["xingbie"].ToString();
                    int    age     = (int)row["age"];
                    context.Response.SetCookie(new HttpCookie("id", id.ToString()));
                    //context.Response.SetCookie(new HttpCookie("name", name.ToString()));
                    //context.Response.SetCookie(new HttpCookie("xingbie", xingbie.ToString()));
                    //context.Response.SetCookie(new HttpCookie("age", age.ToString()));
                    //context.Response.Redirect("my_info.aspx");
                    //context.Response.Write("姓名:" + name + "性别:" + xingbie + "年龄:" + age + "\n账号:" + id + "\n密码:" + keys);
                }
            }
            else
            {
                context.Response.Write("error");
            }
        }
示例#2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.ContentType = "text/html";
            int id = Convert.ToInt32(context.Request["id"]);

            Sqlhelper1.ExecuteScalar("delete from student where id=@id", new SqlParameter("@id", id));
            context.Response.Write("<script>confirm('删除成功');location.href = '../aspx/my_info.aspx';</script>");
        }
示例#3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.ContentType = "text/html";
            string id      = context.Request["id"];
            string keys    = context.Request["keys"];
            string name    = context.Request["name"];
            string xingbie = context.Request["xingbie"];
            string age     = context.Request["age"];

            Sqlhelper1.ExecuteScalar("delete from student where id=@id", new SqlParameter("@id", id));
            Sqlhelper1.ExecuteScalar("insert into student (id,keys,name,xingbie,age)values (@id,@keys,@name,@xingbie,@age)", new SqlParameter("@id", id), new SqlParameter("@keys", keys), new SqlParameter("@name", name), new SqlParameter("@xingbie", xingbie), new SqlParameter("@age", age));
            context.Response.Write("<script>confirm('修改成功');location.href = '../aspx/my_info.aspx';</script>");
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie1 = Request.Cookies["id"];

            //HttpCookie cookie2 = Request.Cookies["name"];
            //HttpCookie cookie3 = Request.Cookies["xingbie"];
            //HttpCookie cookie4 = Request.Cookies["age"];
            id = cookie1.Value;
            dt = Sqlhelper1.ExecuteDataTable("select * from student where id=@id", new SqlParameter("@id", id));
            da = Sqlhelper1.ExecuteDataTable("select * from student ", new SqlParameter("@id", id));
            // (DataRow row in ds.Rows)
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                name    = dt.Rows[i]["name"].ToString();
                xingbie = dt.Rows[i]["xingbie"].ToString();
                age     = dt.Rows[i]["age"].ToString();
            }
            // id = cookie1.Value;
            //name = cookie2.Value;
            //xingbie = cookie3.Value;
            // age = cookie4.Value;
        }
示例#5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            // context.Response.Write("Hello World");
            context.Response.ContentType = "text/html";
            string str2 = context.Request["use1"];
            string str3 = context.Request["password4"];
            string str4 = context.Request["password5"];
            string str5 = context.Request["password6"];
            string str6 = context.Request["password7"];
            string str7 = context.Request["password8"];

            if (str3 != str4)
            {
                context.Response.Write("<script>alert('两次输入密码不一致!!');location.href = 'register.ashx';</script>");
            }
            else
            {
                Sqlhelper1.ExecuteScalar("insert into student (id,keys,name,xingbie,age)values (@id,@keys,@name,@xingbie,@age)", new SqlParameter("@id", str2), new SqlParameter("@keys", str3), new SqlParameter("@name", str5), new SqlParameter("@xingbie", str6), new SqlParameter("@age", str7));
                context.Response.Write("<script>alert('注册成功 ');location.href = '../html/login.html';</script>");
            }
        }
示例#6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request["id"]);
     dt = Sqlhelper1.ExecuteDataTable("select * from student where id=@id", new SqlParameter("@id", id));
 }