コード例 #1
0
        public void build_questions()
        {
            int c = 0;

            SqlConnection con_question = new SqlConnection("Data Source=RAHULROY-DESKPC\\RAHULROYDESKTOP;Initial Catalog=EvaluateYourSelf;Integrated Security=True");
            con_question.Open();
            SqlCommand cmdx = new SqlCommand("select * from questions_DB", con_question);
            questionBank = new Question[10];
            SqlDataReader dr = cmdx.ExecuteReader();

            while (dr.Read())
            {
                questionBank[c] = new Question(
                    false,
                    (c+1),
                    Convert.ToInt32(dr[0]),
                    Convert.ToInt32(dr[1]),
                    Convert.ToString(dr[2]),
                    Convert.ToString(dr[3]),
                    Convert.ToString(dr[4]),
                    Convert.ToString(dr[5]),
                    Convert.ToString(dr[6])
                    );
                if (Session[(c + 1).ToString()]!=null)
                    questionBank[c].selected_answer_No = (int)Session[(c + 1).ToString()];

                c++;

            }
            dr.Close();
            con_question.Close();
        }
コード例 #2
0
 public void display_Question(Question Q)
 {
     Q.AnswerChanged = false;
     this.ques_no.Text = Convert.ToString(Q.DispQues_No) + " .";
     this.Label1_question.Text = Convert.ToString(Q.question);
     this.RadioButton1.Text = Convert.ToString(Q.optns[0]);
     this.RadioButton2.Text = Convert.ToString(Q.optns[1]);
     this.RadioButton3.Text = Convert.ToString(Q.optns[2]);
     this.RadioButton4.Text = Convert.ToString(Q.optns[3]);
 }
コード例 #3
0
        public void build_questions()
        {
            SqlConnection con_question = new SqlConnection("Data Source=RAHULROY-DESKPC\\RAHULROYDESKTOP;Initial Catalog=EvaluateYourSelf;Integrated Security=True");
            con_question.Open();
            SqlCommand cmdx = new SqlCommand("select * from questions_DB where question_No = "+count, con_question);
            questionBank = new Question[1];
            SqlDataReader dr = cmdx.ExecuteReader();
            while (dr.Read())
            {
                questionBank[0] = new Question(false,
                (count),
                Convert.ToInt32(dr[0]),
                Convert.ToInt32(dr[1]),
                Convert.ToString(dr[2]),
                Convert.ToString(dr[3]),
                Convert.ToString(dr[4]),
                Convert.ToString(dr[5]),
                Convert.ToString(dr[6]));

            }
            dr.Close();
            con_question.Close();
            currentQ = questionBank[0];
        }