Asp.net Network Examination System Analysis (2)

Source: Internet
Author: User
<% @ Page Language = "C #" %>
<% @ Import Namespace = "System. Data" %>
<% @ Import Namespace = "System. Data. OleDb" %>
<Script runat = "server">
String Lesson;
String No;
String Name;
OleDbDataReader dr;
Void Page_Load (Object Src, EventArgs E ){
Lesson = Request ["Lesson"];
No = Request ["No"];
Name = Request ["Name"];
String SQL = "Select * From" + Lesson + "Order By question ";
OleDbConnection Conn;
Conn = new OleDbConnection ("Provider = Microsoft. Jet. OLEDB.4.0;" +
"Data Source =" + Server. MapPath ("test. mdb "));
Conn. Open ();
// Response. Write (SQL );
OleDbCommand Comm = new OleDbCommand (SQL, Conn );
Dr = Comm. ExecuteReader ();
}
</Script>
<HTML>
<Body bgcolor = BEIGE>
<CENTER>
<H1> <font color = # 6699DD> online examination system </FONT> </H1>
</CENTER>
<H2> exam subjects -- <% = Lesson %> <HR> </H2>
<FORM Action = "Score. aspx" Method = "GET">
<INPUT Type = "Hidden" Name = "Lesson" Value = <% = Lesson %>
<INPUT Type = "Hidden" Name = "No" Value = <% = No %>
<INPUT Type = "Hidden" Name = "Name" Value = <% = Name %>
<%
String TestType = "";
While (dr. Read ()){
Response. Write ("<B>" + dr ["Question"]. ToString () + "."
+ Server. HtmlEncode (dr ["Question"]. ToString ())
+ Dr ["type"]. ToString () + ":" + dr ["score"]. ToString () + "score) </B> ");
Response. Write ("<div> ");
For (int I = 1; I <5; I ++ ){
If (dr ["type"]. ToString () = "single choice "){
TestType = "Radio ";
}
Else {
TestType = "CheckBox ";
}
Response. Write ("<INPUT Type =" + TestType
+ "Name = No" + dr ["Question"]. ToString ()
+ "Value =" + I + ">"
+ Server. HtmlEncode (dr ["option" + I]. ToString () + "<BR> ");
}
Response. Write ("</div> ");
}
%>
<INPUT Type = Submit Value = "Submit">
</FORM> <HR> </BODY>
</HTML>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.