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

数据库编程

开发平台:

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 teacher_arrangement : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         string stu_Id = Request.QueryString["stu_Id"];
  17.         //string stu_Id = "63081500001";
  18.         string teacherlists = "";
  19.         SqlConnection connection = DB.connect_la();
  20.         connection.Open();
  21.         string commandString = "SELECT thesis_total FROM thesis WHERE stu_id= " + stu_Id;
  22.         SqlCommand cmd = new SqlCommand(commandString, connection);
  23.         SqlDataReader sdr = cmd.ExecuteReader();
  24.         if (sdr.Read())
  25.             Label1.Text = sdr.GetValue(0).ToString();
  26.         sdr.Close();
  27.         commandString = "SELECT exam_stu_table.stu_name FROM exam_stu_table,stu_id_num where exam_stu_table.exam_id =stu_id_num.exam_id and stu_id_num.stu_id=" + stu_Id;
  28.         SqlCommand cmd2 = new SqlCommand(commandString, connection);
  29.         SqlDataReader sdr2 = cmd2.ExecuteReader();
  30.         if (sdr2.Read())
  31.             Label2.Text = sdr2.GetValue(0).ToString();
  32.         sdr2.Close();
  33.         commandString = "SELECT * FROM rep_to_arg where stu_id=" + stu_Id;
  34.         SqlCommand cmd3 = new SqlCommand(commandString, connection);
  35.         SqlDataReader sdr3 = cmd3.ExecuteReader();
  36.         if (sdr3.Read())
  37.         {
  38.             teacherlists = sdr3.GetValue(3).ToString();
  39.             Label4.Text = sdr3.GetValue(1).ToString().Substring(0, 10);
  40.             Label5.Text = sdr3.GetValue(1).ToString().Substring(10, 8);
  41.             Label6.Text = sdr3.GetValue(2).ToString();
  42.         }
  43.         sdr3.Close();
  44.         int beginIndex = 0;
  45.         //提取答辩老师姓名
  46.         for (int i = 0; (beginIndex + i) < teacherlists.Length; i++)
  47.         {
  48.             commandString = "SELECT tea_name FROM tea_table where tea_id=" + teacherlists.Substring(beginIndex, 8);
  49.             SqlCommand cmd4 = new SqlCommand(commandString, connection);
  50.             SqlDataReader sdr4 = cmd4.ExecuteReader();
  51.             if (sdr4.Read())
  52.             {
  53.                 if (0 == beginIndex)
  54.                 {
  55.                     Label7.Text = sdr4.GetValue(0).ToString();
  56.                 }
  57.                 else
  58.                 {
  59.                     Label7.Text += ", ";
  60.                     Label7.Text += sdr4.GetValue(0).ToString();
  61.                 }
  62.             }
  63.             sdr4.Close();
  64.             beginIndex += 9;
  65.         }
  66.         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;
  67.         SqlCommand cmd7 = new SqlCommand(commandString, connection);
  68.         SqlDataReader sdr7 = cmd7.ExecuteReader();
  69.         if (sdr7.Read())
  70.         {
  71.             Label3.Text = sdr7.GetValue(0).ToString();
  72.         }
  73.         sdr7.Close();
  74.         connection.Close();
  75.     }
  76. }