stu_details.aspx.cs
上传用户:ah_jiwei
上传日期:2022-07-24
资源大小:54044k
文件大小:4k
源码类别:

数据库编程

开发平台:

Visual C++

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. public partial class administration_details : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         string stu_Id = Request.QueryString["stu_Id"].ToString();
  17.         SqlConnection connection = DB.connect_la();
  18.         connection.Open();
  19.         string commandString = "SELECT exam_stu_table.* FROM exam_stu_table,stu_id_num WHERE stu_id_num.exam_id=exam_stu_table.exam_id and stu_id_num.stu_id='" + stu_Id+ "'";
  20.         SqlCommand cmd = new SqlCommand(commandString, connection);
  21.         SqlDataReader sdr = cmd.ExecuteReader();
  22.         if (sdr.Read())
  23.         {
  24.             Label11.Text = sdr.GetValue(1).ToString();
  25.             Label13.Text = sdr.GetValue(27).ToString();
  26.             if (sdr.GetInt32(3) == 0)
  27.                 Label12.Text = "男";
  28.             else
  29.                 Label12.Text = "女";
  30.             Label14.Text = sdr.GetValue(13).ToString();
  31.            
  32.         }
  33.         sdr.Close();
  34.         commandString = "SELECT avg_point FROM stu_id_num WHERE  stu_id_num.stu_id=" + stu_Id;
  35.         SqlCommand cmd1 = new SqlCommand(commandString, connection);
  36.         SqlDataReader sdr1 = cmd1.ExecuteReader();
  37.         if (sdr1.Read())
  38.         {
  39.             Label15.Text = sdr1.GetDecimal(0).ToString();
  40.         }
  41.         sdr1.Close();
  42.         commandString = "SELECT * FROM thsis_data WHERE stu_id= " + stu_Id;
  43.         SqlCommand cmd2 = new SqlCommand(commandString, connection);
  44.         SqlDataReader sdr2 = cmd2.ExecuteReader();
  45.         if (sdr2.Read())
  46.         {
  47.             Label6.Text = sdr2.GetValue(3).ToString();
  48.             Label7.Text = sdr2.GetValue(4).ToString();
  49.             Label8.Text = sdr2.GetValue(2).ToString();
  50.             Label9.Text = sdr2.GetValue(1).ToString();
  51.         }
  52.         sdr2.Close();
  53.         commandString = "SELECT thesis_state FROM thesis where stu_id=" + stu_Id;
  54.         SqlCommand cmd3 = new SqlCommand(commandString, connection);
  55.         SqlDataReader sdr3 = cmd3.ExecuteReader();
  56.         if (sdr3.Read())
  57.             Label10.Text = sdr3.GetValue(0).ToString();
  58.         sdr3.Close();
  59.         string teacherlists = "";
  60.         Label1.Text = stu_Id;
  61.        commandString = "SELECT thesis_total FROM thesis WHERE stu_id= " + stu_Id;
  62.         SqlCommand cmd4 = new SqlCommand(commandString, connection);
  63.         SqlDataReader sdr4 = cmd4.ExecuteReader();
  64.         if (sdr4.Read())
  65.             Label5.Text = sdr4.GetValue(0).ToString();
  66.         sdr4.Close();
  67.         commandString = "SELECT * FROM rep_to_arg where stu_id=" + stu_Id;
  68.         SqlCommand cmd5 = new SqlCommand(commandString, connection);
  69.         SqlDataReader sdr5 = cmd5.ExecuteReader();
  70.         if (sdr5.Read())
  71.         {
  72.             teacherlists = sdr5.GetValue(3).ToString();
  73.             Label3.Text = sdr5.GetValue(1).ToString();
  74.             Label4.Text = sdr5.GetValue(2).ToString();
  75.         }
  76.         sdr5.Close();
  77.         int beginIndex = 0;
  78.         //提取答辩老师姓名
  79.         for (int i = 0; (beginIndex + i) < teacherlists.Length; i++)
  80.         {
  81.             commandString = "SELECT tea_name FROM tea_table where tea_id=" + teacherlists.Substring(beginIndex, 8);
  82.             SqlCommand cmd6 = new SqlCommand(commandString, connection);
  83.             SqlDataReader sdr6 = cmd6.ExecuteReader();
  84.             Label1.Text = stu_Id;
  85.             if (sdr6.Read())
  86.             {
  87.                 if (0 == beginIndex)
  88.                 {
  89.                     Label2.Text = sdr6.GetValue(0).ToString();
  90.                 }
  91.                 else
  92.                 {
  93.                     Label2.Text += ", ";
  94.                     Label2.Text += sdr6.GetValue(0).ToString();
  95.                 }
  96.             }
  97.             sdr6.Close();
  98.             beginIndex += 9;
  99.         }
  100.         commandString = "SELECT tea_table.tea_name FROM tea_table,stu_tea where tea_table.tea_id = stu_tea.tea_id and stu_tea.sut_id = " + stu_Id;
  101.         SqlCommand cmd7 = new SqlCommand(commandString, connection);
  102.         SqlDataReader sdr7 = cmd7.ExecuteReader();
  103.         if (sdr7.Read())
  104.         {
  105.             Label6.Text = sdr7.GetValue(0).ToString();
  106.         }
  107.         sdr7.Close();
  108.         connection.Close();
  109.     }
  110. }