⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.aspx.cs

📁 大学英语学习系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
        {
            myConnection.Close();
        }
    }
    public void txtSynQuesBind(String[] Str)
    {
        SqlConnection myConnection = new SqlConnection(ConnectionString);
        try
        {
            String TableName = "TAB_TESTSYNTAX";
            String ColumnName1 = "TSCONTENT";
            String ColumnName2 = "TSNO";
            TextBox[] txtQues ={ txtQues1, txtQues2, txtQues3, txtQues4, txtQues5, txtQues6, txtQues7, txtQues8, txtQues9, txtQues10, txtQues11, txtQues12, txtQues13, txtQues14, txtQues15, txtQues16, txtQues17, txtQues18, txtQues19, txtQues20, txtQues21, txtQues22, txtQues23, txtQues24, txtQues25, txtQues26, txtQues27, txtQues28, txtQues29, txtQues30 };
            for (int i = 0; i < synTestNumber; i++)
            {
                String conString = "SELECT " + ColumnName1 + " FROM " + TableName + " where " + ColumnName2 + "='" + Str[i] + "'";
                SqlDataAdapter da = new SqlDataAdapter(conString, myConnection);
                DataSet ds = new DataSet();
                da.Fill(ds);
                DataTable Table = ds.Tables[0];
                if (Table.Rows.Count == 0)
                    continue;
                String strTmp = (String)Table.Rows[0].ItemArray[0];
                txtQues[i].Text = strTmp;
            }
        }
        finally
        {
            myConnection.Close();
        }
    }
    public void txtSynAnsBind(String[] Str)
    {
        SqlConnection myConnection = new SqlConnection(ConnectionString);
        try
        {
            String TableName = "TAB_TESTSYNTAX";
            String ColumnName1 = "A";
            String ColumnName2 = "B";
            String ColumnName3 = "C";
            String ColumnName4 = "D";
            String ColumnName5 = "TSNO";
            String ColumnName6 = "TSKEY";
            String[] strOption ={ "A.", "B.", "C.", "D." };
            RadioButtonList[] synRd ={ synRd1, synRd2, synRd3, synRd4, synRd5, synRd6, synRd7, synRd8, synRd9, synRd10, synRd11, synRd12, synRd13, synRd14, synRd15, synRd16, synRd17, synRd18, synRd19, synRd20, synRd21, synRd22, synRd23, synRd24, synRd25, synRd26, synRd27, synRd28, synRd29, synRd30 };
            for (int i = 0; i < 30; i++)
            {
                String conString = "SELECT " + ColumnName1 + "," + ColumnName2 + "," + ColumnName3 + "," + ColumnName4 + "," + ColumnName6 + " FROM " + TableName + " where " + ColumnName5 + "='" + Str[i] + "'";
                SqlDataAdapter da = new SqlDataAdapter(conString, myConnection);
                DataSet ds = new DataSet();
                da.Fill(ds);
                DataTable Table = ds.Tables[0];
                if (Table.Rows.Count == 0)
                {
                    strAnswer[20 + i] = "题为空";
                    continue;
                }
                for (int k = 0; k < 4; k++)
                {
                    synRd[i].Items[k].Value = strOption[k] + (String)Table.Rows[0].ItemArray[k];
                }
                strAnswer[20 + i] = (String)Table.Rows[0].ItemArray[4];
            }
        }
        finally
        {
            myConnection.Close();
        }
    }
    public void txtFullBind(String[] Str)
    {
        SqlConnection myConnection = new SqlConnection(ConnectionString);
        try
        {
            String TableName = "TAB_TESTFULL";
            String ColumnName1 = "TFCONTENT";
            String ColumnName2 = "TFNO";
            String conString = "SELECT " + ColumnName1 + " FROM " + TableName + " where " + ColumnName2 + "='" + Str[0] + "'";
            SqlDataAdapter da = new SqlDataAdapter(conString, myConnection);
            DataSet ds = new DataSet();
            da.Fill(ds);
            DataTable Table = ds.Tables[0];
            if (Table.Rows.Count == 0)
                return;
            String strTmp = (String)Table.Rows[0].ItemArray[0];
            TxtFull.Text =readData(strTmp,"\\Wed\\SubjectManage\\Full\\");
        }
        finally
        {
            myConnection.Close();
        }
    }
    public void txtFullAnsBind(String[] Str)
    {
        SqlConnection myConnection = new SqlConnection(ConnectionString);
        try
        {
            String TableName = "TAB_TESTFULLKEY";
            String ColumnName1 = "A";
            String ColumnName2 = "B";
            String ColumnName3 = "C";
            String ColumnName4 = "D";
            String ColumnName5 = "TFNO";
            String ColumnName6 = "ANO";
            String ColumnName7 = "TFKEY";
            String[] strOption ={ "A.", "B.", "C.", "D." };
            String[] strQno ={ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };
            RadioButtonList[] fullRd ={ fullRd1, fullRd2, fullRd3, fullRd4, fullRd5, fullRd6, fullRd7, fullRd8, fullRd9, fullRd10, fullRd11, fullRd12, fullRd13, fullRd14, fullRd15, fullRd16, fullRd17, fullRd18, fullRd19, fullRd20 };
            for (int i = 0; i < fullQuesNumber; i++)
            {
                String conString = "SELECT " + ColumnName1 + "," + ColumnName2 + "," + ColumnName3 + "," + ColumnName4 + "," + ColumnName7 + " FROM " + TableName + " where " + ColumnName5 + "='" + Str[0] + "'and " + ColumnName6 + "='" + strQno[i] + "'";
                SqlDataAdapter da = new SqlDataAdapter(conString, myConnection);
                DataSet ds = new DataSet();
                da.Fill(ds);
                DataTable Table = ds.Tables[0];
                if (Table.Rows.Count == 0)
                {
                    strAnswer[50 + i] = "题为空";
                    continue;
                }
                for (int k = 0; k < 4; k++)
                {
                    fullRd[i].Items[k].Value = strOption[k] + (String)Table.Rows[0].ItemArray[k];
                }
                strAnswer[50 + i] = (String)Table.Rows[0].ItemArray[4];
            }
        }
        finally
        {
            myConnection.Close();
        }
    }
    protected void BltNext_Click(object sender, EventArgs e)
    {
        String[] strOption ={ "A", "B", "C", "D" };
        RadioButtonList[] Rd ={ Rd1, Rd2, Rd3, Rd4, Rd5, Rd6, Rd7, Rd8, Rd9, Rd10, Rd11, Rd12, Rd13, Rd14, Rd15, Rd16, Rd17, Rd18, Rd19, Rd20, synRd1, synRd2, synRd3, synRd4, synRd5, synRd6, synRd7, synRd8, synRd9, synRd10, synRd11, synRd12, synRd13, synRd14, synRd15, synRd16, synRd17, synRd18, synRd19, synRd20, synRd21, synRd22, synRd23, synRd24, synRd25, synRd26, synRd27, synRd28, synRd29, synRd30, fullRd1, fullRd2, fullRd3, fullRd4, fullRd5, fullRd6, fullRd7, fullRd8, fullRd9, fullRd10, fullRd11, fullRd12, fullRd13, fullRd14, fullRd15, fullRd16, fullRd17, fullRd18, fullRd19, fullRd20 };

        for (int i = 0; i < 70; i++)
        {
            int j;
            for (j = 0; j < 4; j++)
            {
                if (Rd[i].Items[j].Selected)
                {
                    strAnswer[i] += "&" + strOption[j];
                    break;
                }
            }
            if (j == 4)
                strAnswer[i] += "&" + "未选";
        }
        String[] strAn ={ "test1", "test2", "test3", "test4", "test5", "test6", "test7", "test8", "test9", "test10", "test11", "test12", "test13", "test14", "test15", "test16", "test17", "test18", "test19", "test20", "test21", "test22", "test23", "test24", "test25", "test26", "test27", "test28", "test29", "test30", "test31", "test32", "test33", "test34", "test35", "test36", "test37", "test38", "test39", "test40", "test41", "test42", "test43", "test44", "test45", "test46", "test47", "test48", "test49", "test50", "test51", "test52", "test53", "test54", "test55", "test56", "test57", "test58", "test59", "test60", "test61", "test62", "test63", "test64", "test65", "test66", "test67", "test68", "test69", "test70" };//索引答案
        string sno = Session["USERID"].ToString();
        string sname = Session["USERNAME"].ToString();
        string style = Session["USERSTYLE"].ToString();
        Session.Clear();
        Session["USERID"] = sno;
        Session["USERNAME"] = sname;
        Session["USERSTYLE"] = style;
        for (int i = 0; i < 70; i++)
        {
            Session[strAn[i]] = strAnswer[i];
        }
        String sParam = "?TestNo=" + TestNo;
        sParam += "&Sno=" + Sno;
        Response.Redirect("~/Student/ColTest/ColEvaluate.aspx" + sParam);
    }
    public String readData(String FileName,String FilePath)
    {
        String ss = "";
        String A = Server.MapPath("Exercise.asps");
        String delimStr = "Wed";
        string[] sArray = Regex.Split(A, delimStr, RegexOptions.None);
        int j = 0;
        String[] str = new string[2];
        foreach (string filePath in sArray)
        {
            str[j] = filePath.ToString(); j++;
        }
        try
        {
            FileStream fs = new FileStream(str[0] + FilePath + FileName, FileMode.Open);
            StreamReader sr = new StreamReader(fs);
            ss = sr.ReadToEnd();
            sr.Close();
        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }
        return ss;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -