コード例 #1
0
ファイル: judge_add.aspx.cs プロジェクト: soulcabbage/test
        //初始化数据
        protected void InitData()
        {
            int          judgeProblemID = int.Parse(Request["ID"].ToString()); //取出传递过来的试题编号
            JudgeProblem judgeproblem   = new JudgeProblem();                  //创建判断题对象

            if (judgeproblem.LoadData(judgeProblemID))                         //如果取出题目信息,分别放在相应控件显示
            {
                ddlCourse.SelectedValue = judgeproblem.CourseID.ToString();
                txtTitle.Text           = judgeproblem.Title;
                rblAnswer.SelectedValue = judgeproblem.Answer.ToString();
            }
            else                //查询出错,给出提示
            {
                lblMessage.Text = "加载数据出错!";
            }
        }
コード例 #2
0
ファイル: ChangePanDuan.aspx.cs プロジェクト: sencex/fz
    public void InitData()
    {
        int          judgeProblemID = int.Parse(Request["ID"].ToString()); //取出传递过来的试题编号
        JudgeProblem judgeproblem   = new JudgeProblem();                  //创建判断题对象

        if (judgeproblem.LoadData(judgeProblemID))                         //如果取出题目信息,分别放在相应控件显示
        {
            db.ecDropDownList(ddlCourse, "select * from Course where c_id=(select c_id from JudgeProblem where ID='" + judgeProblemID + "' )", "c_name", "c_id");
            txtTitle.Text = judgeproblem.Title;
            SqlConnection cn = db.getcon();
            cn.Open();
            string     sqlstr1 = "select Answer from JudgeProblem where ID='" + Request["ID"].ToString() + "'";
            SqlCommand cmd1    = new SqlCommand(sqlstr1, cn);
            Label1.Text = cmd1.ExecuteScalar().ToString();
        }
        else                //查询出错,给出提示
        {
            Response.Write("<script>alert('加载数据错误!');</script>");
            Response.Write("<script>window.location.href='ChangePanDuan.aspx'</script>");
        }
    }