예제 #1
0
    protected void Bind(string keyWord)
    {
        DataBase DB = new DataBase();

        Hashtable ht1 = new Hashtable();
        ht1.Add("Title", keyWord);
        ht1.Add("AnswerA", keyWord);
        ht1.Add("AnswerB", keyWord);
        ht1.Add("AnswerC", keyWord);
        ht1.Add("AnswerD", keyWord);

        DataSet ds1 = DB.AdvancedSearch("SingleProblem", ht1);

        if (ds1.Tables[0].Rows.Count > 0)//判断下是否有单选题
        {
            GridView11.DataSource = ds1;
            GridView11.DataBind();
        }

        DataSet ds2 = DB.AdvancedSearch("MultiProblem", ht1);
        if (ds2.Tables[0].Rows.Count > 0)
        {
            GridView2.DataSource = ds2;
            GridView2.DataBind();
        }

        Hashtable ht2 = new Hashtable();
        ht2.Add("Title", keyWord);
        DataSet ds3 = DB.AdvancedSearch("JudgeProblem", ht2);
        if (ds3.Tables[0].Rows.Count > 0)
        {
            GridView3.DataSource = ds3;
            GridView3.DataBind();
        }
    }