Beispiel #1
0
    public String getAnswer()
    {
        String strAnswer = "<table border='1'>";

        DataSetTableAdapters.tb_answerTableAdapter tb_answer = new DataSetTableAdapters.tb_answerTableAdapter();
        DataTable dt_answer = tb_answer.GetData();

        strAnswer += "<tr><td>Id</td><td>Answer</td><td>Question</td></tr>";
        foreach (DataRow dr_answer in dt_answer.Rows)
        {
            Int32  answer_id = (Int32)dr_answer["id"];
            String question  = getQuestion(answer_id);
            strAnswer += "<tr>";
            strAnswer += "<td>" + dr_answer["id"] + "</td>";
            strAnswer += "<td>" + dr_answer["answer"] + "</td>";
            strAnswer += "<td>" + question + "</td>";
            strAnswer += "</tr>";
        }
        strAnswer += "</table>";
        return(strAnswer);
    }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DataSetTableAdapters.tb_answerTableAdapter tb_answer = new DataSetTableAdapters.tb_answerTableAdapter();
     GridView1.DataSource = tb_answer.GetData();
     GridView1.DataBind();
 }