当前位置: 首页>>代码示例>>C#>>正文


C# DataBase.MakeInParam方法代码示例

本文整理汇总了C#中DataBase.MakeInParam方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.MakeInParam方法的具体用法?C# DataBase.MakeInParam怎么用?C# DataBase.MakeInParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataBase的用法示例。


在下文中一共展示了DataBase.MakeInParam方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitData

    //初始化试卷,从数据库中将试题取出
    protected void InitData()
    {
        DataBase DB = new DataBase();
        int paperID = Convert.ToInt32(Request.QueryString["PaperID"].ToString());

        SqlParameter[] Params1 = new SqlParameter[2];
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题");            //题目类型
        DataSet ds1 = DB.GetDataSet("Proc_PaperDetail", Params1);
        GridView11.DataSource = ds1;
        GridView11.DataBind();
        if (ds1.Tables[0].Rows.Count > 0)
        {
            ((Label)GridView11.HeaderRow.FindControl("Labelt2")).Text = ((Label)GridView11.Rows[0].FindControl("Labelm1")).Text;
        }

        SqlParameter[] Params2 = new SqlParameter[2];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题");            //题目类型
        DataSet ds2 = DB.GetDataSet("Proc_PaperDetail", Params2);
        GridView2.DataSource = ds2;
        GridView2.DataBind();
        if (ds2.Tables[0].Rows.Count > 0)
        {
            ((Label)GridView2.HeaderRow.FindControl("Labelt5")).Text = ((Label)GridView2.Rows[0].FindControl("Labelm2")).Text;
        }

        SqlParameter[] Params3 = new SqlParameter[2];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题");            //题目类型
        DataSet ds3 = DB.GetDataSet("Proc_PaperDetail", Params3);
        GridView3.DataSource = ds3;
        GridView3.DataBind();
        if (ds3.Tables[0].Rows.Count > 0)
        {
            ((Label)GridView3.HeaderRow.FindControl("Labelt8")).Text = ((Label)GridView3.Rows[0].FindControl("Labelm3")).Text;
        }

        SqlParameter[] Params4 = new SqlParameter[2];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题");            //题目类型
        DataSet ds4 = DB.GetDataSet("Proc_PaperDetail", Params4);
        GridView4.DataSource = ds4;
        GridView4.DataBind();
        if (ds4.Tables[0].Rows.Count > 0)
        {
            ((Label)GridView4.HeaderRow.FindControl("Labelt11")).Text = ((Label)GridView4.Rows[0].FindControl("Labelm4")).Text;
        }
        SqlParameter[] Params5 = new SqlParameter[2];
        Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题");            //题目类型
        DataSet ds5 = DB.GetDataSet("Proc_PaperDetail", Params5);
        GridView5.DataSource = ds5;
        GridView5.DataBind();
        if (ds5.Tables[0].Rows.Count > 0)
        {
            ((Label)GridView5.HeaderRow.FindControl("Labelt14")).Text = ((Label)GridView5.Rows[0].FindControl("Labelm5")).Text;
        }
    }
开发者ID:zhouhao,项目名称:OnlineExamSystem,代码行数:60,代码来源:PaperDetail.aspx.cs

示例2: InitData

    //��ʼ���Ծ�������ݿ��н�����ȡ��
    protected void InitData()
    {
        DataBase DB = new DataBase();
        int paperID = Convert.ToInt32(Request.QueryString["PaperID"].ToString());

        SqlParameter[] Params1 = new SqlParameter[2];
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "��ѡ��");            //��Ŀ����
        DataSet ds1 = DB.GetDataSet("Proc_PaperDetailmr", Params1);
        GridView1.DataSource = ds1;
        GridView1.DataBind();

        SqlParameter[] Params2 = new SqlParameter[2];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "��ѡ��");            //��Ŀ����
        DataSet ds2 = DB.GetDataSet("Proc_PaperDetailmr", Params2);
        GridView2.DataSource = ds2;
        GridView2.DataBind();

        SqlParameter[] Params3 = new SqlParameter[2];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�ж���");            //��Ŀ����
        DataSet ds3 = DB.GetDataSet("Proc_PaperDetailmr", Params3);
        GridView3.DataSource = ds3;
        GridView3.DataBind();

        SqlParameter[] Params4 = new SqlParameter[2];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�����");            //��Ŀ����
        DataSet ds4 = DB.GetDataSet("Proc_PaperDetailmr", Params4);
        GridView4.DataSource = ds4;
        GridView4.DataBind();

        SqlParameter[] Params5 = new SqlParameter[2];
        Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�ʴ���");            //��Ŀ����
        DataSet ds5 = DB.GetDataSet("Proc_PaperDetailmr", Params5);
        GridView5.DataSource = ds5;
        GridView5.DataBind();
    }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:41,代码来源:PaperDetail.aspx.cs

示例3: InitData

    //初始化试卷,从数据库中将试题取出
    protected void InitData()
    {
        SqlParameter[] Params1 = new SqlParameter[2];
        DataBase DB = new DataBase();
        int paperID = int.Parse(Session["PaperID"].ToString());
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题");            //题目类型
        DataSet ds1 = DB.GetDataSet("Proc_PaperDetailmr", Params1);
        GridView1.DataSource = ds1;
        GridView1.DataBind();
        ((Label)GridView1.HeaderRow.FindControl("Label27")).Text = ((Label)GridView1.Rows[0].FindControl("Label4")).Text;

        SqlParameter[] Params2 = new SqlParameter[2];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题");            //题目类型
        DataSet ds2 = DB.GetDataSet("Proc_PaperDetailmr", Params2);
        GridView2.DataSource = ds2;
        GridView2.DataBind();
        ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text;

        SqlParameter[] Params3 = new SqlParameter[2];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题");            //题目类型
        DataSet ds3 = DB.GetDataSet("Proc_PaperDetailmr", Params3);
        GridView3.DataSource = ds3;
        GridView3.DataBind();
        ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text;

        SqlParameter[] Params4 = new SqlParameter[2];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题");            //题目类型
        DataSet ds4 = DB.GetDataSet("Proc_PaperDetailmr", Params4);
        GridView4.DataSource = ds4;
        GridView4.DataBind();
        ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text;
    }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:37,代码来源:TestAnswer.aspx.cs

示例4: InitData

    //初始化试卷,从数据库中将试题取出
    protected void InitData()
    {
        SqlParameter[] Params1 = new SqlParameter[2];
        DataBase DB = new DataBase();
        int paperID = int.Parse(Request.QueryString["PaperID"].ToString());
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.NVarChar, 50, "单选题");            //题目类型
        DataSet ds1 = DB.GetDataSet("Proc_PaperDetail", Params1);
        //程军添加,单选题中是否有单选题。2010-5-26
        if(ds1.Tables[0].Rows.Count == 0)
        {
            GridView1.Visible = false;
        }
        else
        {
         GridView1.DataSource = ds1;
         GridView1.DataBind();

        ((Label)GridView1.HeaderRow.FindControl("Label27")).Text = ((Label)GridView1.Rows[0].FindControl("Label4")).Text;
        } //程军添加,单选题中是否有单选题。2010-5-26

        SqlParameter[] Params2 = new SqlParameter[2];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.NVarChar, 50, "多选题");            //题目类型
        DataSet ds2 = DB.GetDataSet("Proc_PaperDetail", Params2);
        //程军添加,多选题中是否有多选题。2010-5-26
        if(ds2.Tables[0].Rows.Count == 0)
        {
            GridView2.Visible = false;
        }
        else
        {
         GridView2.DataSource = ds2;
         GridView2.DataBind();

         ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text;
        }//程军添加,多选题中是否有多选题。2010-5-26

        SqlParameter[] Params3 = new SqlParameter[2];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.NVarChar, 50, "判断题");            //题目类型
        DataSet ds3 = DB.GetDataSet("Proc_PaperDetail", Params3);
        //程军添加,判断题库中是否有判断题.2010-5-26
        if (ds3.Tables[0].Rows.Count == 0)
        {
            GridView3.Visible = false;
        }
        else
        {
            GridView3.DataSource = ds3;
            GridView3.DataBind();
            ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text;

        }//程军添加,判断题库中是否有判断题,2010-5-26

        SqlParameter[] Params4 = new SqlParameter[2];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.NVarChar, 50, "填空题");            //题目类型
        DataSet ds4 = DB.GetDataSet("Proc_PaperDetail", Params4);
        //程军添加,判断题库中是否有填空题,2010-5-26
        if (ds4.Tables[0].Rows.Count == 0)
        {
            GridView4.Visible = false;
        }
        else
        {
            GridView4.DataSource = ds4;
            GridView4.DataBind();
            ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text;

        }//程军添加,判断题库中是否有填空题,2010-5-26
    }
开发者ID:dalinhuang,项目名称:my-project-step,代码行数:73,代码来源:PaperDetail.aspx.cs

示例5: Reg

    /// <summary>
    /// 注册用户方法
    /// </summary>
    /// <param name="userName">注册名</param>
    /// <param name="passWord">密码</param>
    /// <param name="email">电子邮箱</param>
    /// <param name="qq">QQ</param>
    /// <param name="sex">性别,true为男,false为女</param>
    /// <param name="isadmin">是否管理员</param>
    /// <param name="regTime">注册日期</param>
    /// <returns></returns>
    public static bool Reg(string userName, string passWord, string email, string qq, bool sex, bool isadmin, DateTime regTime)
    {
        DataBase db = new DataBase();
        if (db.RunProc("INSERT INTO tb_user (userName, passWord, email, qq)VALUES   (@username,@password,@email,@qq)",
             new SqlParameter[]{
          db.MakeInParam("username",System.Data.SqlDbType.VarChar,20,userName),
          db.MakeInParam("password",System.Data.SqlDbType.VarChar,200,passWord),
          db.MakeInParam("email",System.Data.SqlDbType.VarChar,50,email),
          db.MakeInParam("qq",System.Data.SqlDbType.VarChar,15,qq)
        }) == 0)
        {
            return false;
        }
        else
        {

            return true;
        }
    }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:30,代码来源:UserOperation.cs

示例6: Login

 /// <summary>
 /// 登陆
 /// </summary>
 /// <param name="Session">Session</param>
 /// <param name="userName">用户名</param>
 /// <param name="password">密码</param>
 /// <returns>成功为true,失败为false</returns>
 public static bool Login(System.Web.SessionState.HttpSessionState Session, string userName, string password)
 {
     if (userName == "" || password == "")
     {
         return false;
     }
     DataBase db = new DataBase(); /*实例化一个数据库。*/
     String str = Encrypt.encrypt(password);
     DataSet result = db.RunProcReturn("select * from tb_user where [email protected] and [email protected]", new SqlParameter[] {
     db.MakeInParam("username",System.Data.SqlDbType.VarChar,20,userName),
     db.MakeInParam("password",System.Data.SqlDbType.VarChar,200,str)
     }, "tb_user");     /*查询数据库中与输入的用户名密码相同的集。*/
     if (result.Tables[0].Rows.Count != 0)    /*  如数据库中有用户名密码与输入的用户名密码相同,则将username和password、uid放入session中。*/
     {
         Session.Add("username", userName);
         Session.Add("password", password);
         Session.Add("uid", result.Tables[0].Rows[0]["id"].ToString());
         Session.Add("isadmin", result.Tables[0].Rows[0]["isadmin"]);
         Session.Remove("loginerror");
         return true;
     }
     else
     {
         Session.Add("loginerror", true);
         return false;
     }
 }
开发者ID:ChenYiXiao,项目名称:ZCoder,代码行数:34,代码来源:UserOperation.cs

示例7: PaperData

    //初始化试卷,从数据库中将试题取出
    protected void PaperData()
    {
        string userid = Request.QueryString["UserID"].ToString();
        paperid = int.Parse(Request.QueryString["PaperID"].ToString());

        DataBase DB = new DataBase();

        DataSet ds = DB.GetDataSetSql("select * from [UserAnswertb] where UserID='" + userid + "'");
        DataRow[] row = ds.Tables[0].Select();
        foreach (DataRow rs in row)
        {
            lblExamtime.Text = rs["ExamTime"].ToString();
        }

        SqlParameter[] Params1 = new SqlParameter[3];
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题");
        Params1[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds1 = DB.GetDataSet("Proc_UserAnswertb", Params1);
        if (ds1.Tables[0].Rows.Count > 0)
        {
            GridView11.DataSource = ds1;
            GridView11.DataBind();
            ((Label)GridView11.HeaderRow.FindControl("Label27")).Text = ((Label)GridView11.Rows[0].FindControl("Label4")).Text;
        }

        SqlParameter[] Params2 = new SqlParameter[3];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题");
        Params2[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds2 = DB.GetDataSet("Proc_UserAnswertb", Params2);
        if (ds2.Tables[0].Rows.Count > 0)
        {
            GridView2.DataSource = ds2;
            GridView2.DataBind();
            ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text;
        }

        SqlParameter[] Params3 = new SqlParameter[3];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题");
        Params3[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds3 = DB.GetDataSet("Proc_UserAnswertb", Params3);
        if (ds3.Tables[0].Rows.Count > 0)
        {
            GridView3.DataSource = ds3;
            GridView3.DataBind();
            ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text;
        }

        SqlParameter[] Params4 = new SqlParameter[3];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题");
        Params4[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds4 = DB.GetDataSet("Proc_UserAnswertb", Params4);
        if (ds4.Tables[0].Rows.Count > 0)
        {
            GridView4.DataSource = ds4;
            GridView4.DataBind();
            ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text;
        }
        SqlParameter[] Params5 = new SqlParameter[3];
        Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题");
        Params5[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds5 = DB.GetDataSet("Proc_UserAnswertb", Params5);
        if (ds5.Tables[0].Rows.Count > 0)
        {
            GridView5.DataSource = ds5;
            GridView5.DataBind();
            ((Label)GridView5.HeaderRow.FindControl("Label31")).Text = ((Label)GridView5.Rows[0].FindControl("Label21")).Text;
        }

        if (GridView11.Rows.Count > 0)
        {
            int score1 = 0;
            int singlemark = int.Parse(((Label)GridView11.Rows[0].FindControl("Label4")).Text);//取出单选题的每题分值
            foreach (GridViewRow dr in GridView11.Rows)
            {
                if (((Label)dr.FindControl("Label3")).Text.Trim() == "A")
                {
                    ((RadioButton)dr.FindControl("RadioButton1")).Checked = true;
                }
                else if (((Label)dr.FindControl("Label3")).Text.Trim() == "B")
                {
                    ((RadioButton)dr.FindControl("RadioButton2")).Checked = true;
                }
                else if (((Label)dr.FindControl("Label3")).Text.Trim() == "C")
                {
                    ((RadioButton)dr.FindControl("RadioButton3")).Checked = true;
                }
                else if (((Label)dr.FindControl("Label3")).Text.Trim() == "D")
                {
                    ((RadioButton)dr.FindControl("RadioButton4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label3")).Text.Trim() == ((Label)dr.FindControl("Label23")).Text.Trim())
                {
                    score1 = score1 + singlemark;
                    sinScore.Text = Convert.ToString(score1);
//.........这里部分代码省略.........
开发者ID:zhouhao,项目名称:OnlineExamSystem,代码行数:101,代码来源:UserPaper.aspx.cs

示例8: InitData

    //初始化试卷,从数据库中将试题取出
    protected void InitData()
    {
        DataBase DB = new DataBase();
        int paperID = int.Parse(Session["PaperID"].ToString());
        SqlParameter[] Params1 = new SqlParameter[2];
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题");            //题目类型
        DataSet ds1 = DB.GetDataSet("Proc_PaperDetail", Params1);
        if (ds1.Tables[0].Rows.Count > 0)//判断下是否有单选题
        {
            GridView11.DataSource = ds1;
            GridView11.DataBind();
            ((Label)GridView11.HeaderRow.FindControl("Label27")).Text = ((Label)GridView11.Rows[0].FindControl("Label4")).Text;
        }

        SqlParameter[] Params2 = new SqlParameter[2];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题");            //题目类型
        DataSet ds2 = DB.GetDataSet("Proc_PaperDetail", Params2);
        if (ds2.Tables[0].Rows.Count > 0)
        {
            GridView2.DataSource = ds2;
            GridView2.DataBind();
            ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text;
        }

        SqlParameter[] Params3 = new SqlParameter[2];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题");            //题目类型
        DataSet ds3 = DB.GetDataSet("Proc_PaperDetail", Params3);
        if (ds3.Tables[0].Rows.Count > 0)
        {
            GridView3.DataSource = ds3;
            GridView3.DataBind();
            ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text;
        }

        SqlParameter[] Params4 = new SqlParameter[2];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题");            //题目类型
        DataSet ds4 = DB.GetDataSet("Proc_PaperDetail", Params4);
        if (ds4.Tables[0].Rows.Count > 0)
        {
            GridView4.DataSource = ds4;
            GridView4.DataBind();
            ((Label)GridView4.HeaderRow.FindControl("Label45")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text;
        }
        SqlParameter[] Params5 = new SqlParameter[2];
        Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题");            //题目类型
        DataSet ds5 = DB.GetDataSet("Proc_PaperDetail", Params5);
        if (ds5.Tables[0].Rows.Count > 0)
        {
            GridView5.DataSource = ds5;
            GridView5.DataBind();
            ((Label)GridView5.HeaderRow.FindControl("Label31")).Text = ((Label)GridView5.Rows[0].FindControl("Label37")).Text;
        }
    }
开发者ID:zhouhao,项目名称:OnlineExamSystem,代码行数:59,代码来源:UserExam.aspx.cs

示例9: InitData

    //初始化试卷,从数据库中将试题取出
    protected void InitData()
    {
        DataBase DB = new DataBase();
        string userid = Session["UserID"].ToString();
        paperid = int.Parse(Session["PaperID"].ToString());

        DataSet ds = DB.GetDataSetSql("select * from UserAnswertb where UserID='" + userid + "' and PaperID='" + paperid + "'");

        if (ds.Tables[0].Rows.Count>0)
        {
            sum = right =  error =  noDone = 0;//初始化变量

            SqlParameter[] Params1 = new SqlParameter[3];
            Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
            Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题");
            Params1[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
            DataSet ds1 = DB.GetDataSet("Proc_UserAnswertb", Params1);
            if (ds1.Tables[0].Rows.Count > 0)
            {
                GridView11.DataSource = ds1;
                GridView11.DataBind();
                ((Label)GridView11.HeaderRow.FindControl("Label27")).Text = ((Label)GridView11.Rows[0].FindControl("Label4")).Text;
            }

            SqlParameter[] Params2 = new SqlParameter[3];
            Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
            Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题");
            Params2[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
            DataSet ds2 = DB.GetDataSet("Proc_UserAnswertb", Params2);
            if (ds2.Tables[0].Rows.Count > 0)
            {
                GridView2.DataSource = ds2;
                GridView2.DataBind();
                ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text;
            }

            SqlParameter[] Params3 = new SqlParameter[3];
            Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
            Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题");
            Params3[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
            DataSet ds3 = DB.GetDataSet("Proc_UserAnswertb", Params3);
            if (ds3.Tables[0].Rows.Count > 0)
            {
                GridView3.DataSource = ds3;
                GridView3.DataBind();
                ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text;
            }
            SqlParameter[] Params4 = new SqlParameter[3];
            Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
            Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题");
            Params4[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
            DataSet ds4 = DB.GetDataSet("Proc_UserAnswertb", Params4);
            if (ds4.Tables[0].Rows.Count > 0)
            {
                GridView4.DataSource = ds4;
                GridView4.DataBind();
                ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text;
            }

            SqlParameter[] Params5 = new SqlParameter[3];
            Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
            Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题");
            Params5[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
            DataSet ds5 = DB.GetDataSet("Proc_UserAnswertb", Params5);
            if (ds5.Tables[0].Rows.Count > 0)
            {
                GridView5.DataSource = ds5;
                GridView5.DataBind();
                ((Label)GridView5.HeaderRow.FindControl("Label31")).Text = ((Label)GridView5.Rows[0].FindControl("Label21")).Text;
            }

            //得到题目总数
            sum = GridView11.Rows.Count + GridView2.Rows.Count + GridView3.Rows.Count + GridView4.Rows.Count ;

            if (GridView11.Rows.Count > 0)
            {
                foreach (GridViewRow dr in GridView11.Rows)
                {
                    if (((Label)dr.FindControl("Label3")).Text.Trim() == "A")
                    {
                        ((RadioButton)dr.FindControl("RadioButton1")).Checked = true;
                    }
                    else if (((Label)dr.FindControl("Label3")).Text.Trim() == "B")
                    {
                        ((RadioButton)dr.FindControl("RadioButton2")).Checked = true;
                    }
                    else if (((Label)dr.FindControl("Label3")).Text.Trim() == "C")
                    {
                        ((RadioButton)dr.FindControl("RadioButton3")).Checked = true;
                    }
                    else if (((Label)dr.FindControl("Label3")).Text.Trim() == "D")
                    {
                        ((RadioButton)dr.FindControl("RadioButton4")).Checked = true;
                    }
                    if (((Label)dr.FindControl("Label3")).Text.Trim() == ((Label)dr.FindControl("lbSingleAnswer")).Text.Trim())
                    {

                        right++;

//.........这里部分代码省略.........
开发者ID:zhouhao,项目名称:OnlineExamSystem,代码行数:101,代码来源:UserTest.aspx.cs


注:本文中的DataBase.MakeInParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。