コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            studentBLL sb = new studentBLL();
            student    s  = new student();

            try
            {
                s.student_id   = Int32.Parse(TextBox1.Text);
                s.student_name = TextBox2.Text;
                s.student_sex  = TextBox3.Text;
                s.born_date    = DateTime.Parse(TextBox4.Text);
                s.class_no     = Int32.Parse(TextBox5.Text);
                s.tele_number  = TextBox6.Text;
                s.ru_date      = DateTime.Parse(TextBox7.Text);
                s.address      = TextBox8.Text;
                s.comment      = TextBox9.Text;
            }
            catch (Exception ex)
            {
                s.student_id   = 99999999;
                s.student_name = ex.Message;
                s.student_sex  = "temp";
                s.born_date    = DateTime.Parse("2060/01/01 0:00:00");
                s.class_no     = 88888888;
                s.tele_number  = "temp";
                s.ru_date      = DateTime.Parse("2060/01/01 0:00:00");
                s.address      = "temp";
                s.comment      = "temp";
            }
            Response.Redirect("showAll.aspx?name=" + name + "&succLine=" + sb.AddNew(s).ToString());
        }
コード例 #2
0
ファイル: Login.aspx.cs プロジェクト: mxsxs/gitStudy
        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>");
            }
        }