Ejemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            studentBLL sb = new studentBLL();
            string     uname = TextBox1.Text, upass = TextBox2.Text;

            string[,] b = sb.Get(20000301, uname, upass);
            bool loginSucc = false;

            try
            {//存在[数组b索引不超界限切账号密码正确->默认的false改为true]
                loginSucc = b[0, 0].Replace(" ", "") == uname && b[0, 1].Replace(" ", "") == upass;
                //string tempDebugStr = b.GetLength(0).ToString() + "-" + b.GetLength(1).ToString();
            }
            catch
            {
            }
            if (loginSucc)
            {
                Response.Write("<script>alert(\"loginSucc\");</script>");
                Response.Redirect("showAll.aspx?name=" + uname);
            }
            else
            {
                Response.Write("<script>alert(\"loginError\");</script>");
            }
        }
Ejemplo n.º 2
0
        protected void Button3_Click(object sender, EventArgs e)
        {//update
            string[,] b = sb.Get(20000301, selectId);
            string sqlId = "", sqlName = "", sex = "", born_date = "", class_no = "", tele_number = "", ru_date = "", address = "", comment = "";

            try
            {//存在[数组b索引不超界限切账号密码正确->默认的false改为true]
                sqlId       = selectId;
                sqlName     = b[0, 1].Replace(" ", "");
                sex         = b[0, 2].Replace(" ", "");
                born_date   = b[0, 3];
                class_no    = b[0, 4].Replace(" ", "");
                tele_number = b[0, 5].Replace(" ", "");
                ru_date     = b[0, 6];
                address     = b[0, 7].Replace(" ", "");
                comment     = b[0, 8].Replace(" ", "");
                //string tempDebugStr = b.GetLength(0).ToString() + "-" + b.GetLength(1).ToString();
                Response.Redirect("update.aspx?name=" + name + "&sqlId=" + sqlId + "&sqlName=" + sqlName + "&sex=" + sex + "&born_date=" + born_date + "&class_no=" + class_no + "&tele_number=" + tele_number + "&ru_date=" + ru_date + "&address=" + address + "&comment=" + comment + "");
            }
            catch (Exception ex)
            {
                if (ex.Message == "未将对象引用设置到对象的实例。")
                {
                    Response.Write("<script>alert('未选中');</script>");
                }
                else
                {
                    Response.Write("<script>alert('" + ex.Message + "');</script>");
                }
            }
        }