arrangement.aspx.cs
资源名称:MEIMS.rar [点击查看]
上传用户:ah_jiwei
上传日期:2022-07-24
资源大小:54044k
文件大小:3k
源码类别:
数据库编程
开发平台:
Visual C++
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- public partial class student_arrangement : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string userId = Session["userId"].ToString();
- //string userId = "63081500001";
- string teacherlists = "";
- SqlConnection connection = DB.connect_la();
- connection.Open();
- string commandString = "SELECT thesis_total FROM thesis WHERE stu_id= " + userId;
- SqlCommand cmd = new SqlCommand(commandString, connection);
- SqlDataReader sdr = cmd.ExecuteReader();
- if (sdr.Read())
- Label1.Text = sdr.GetValue(0).ToString();
- sdr.Close();
- 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='" + userId+"'";
- SqlCommand cmd2 = new SqlCommand(commandString, connection);
- SqlDataReader sdr2 = cmd2.ExecuteReader();
- if (sdr2.Read())
- Label2.Text = sdr2.GetValue(0).ToString();
- sdr2.Close();
- commandString = "SELECT * FROM rep_to_arg where stu_id=" + userId;
- SqlCommand cmd3 = new SqlCommand(commandString, connection);
- SqlDataReader sdr3 = cmd3.ExecuteReader();
- if (sdr3.Read())
- {
- teacherlists = sdr3.GetValue(3).ToString();
- Label4.Text = sdr3.GetValue(1).ToString().Substring(0, 10);
- Label5.Text = sdr3.GetValue(1).ToString().Substring(10, 8);
- Label6.Text = sdr3.GetValue(2).ToString();
- }
- sdr3.Close();
- int beginIndex = 0;
- //提取答辩老师姓名
- for (int i = 0; (beginIndex + i) < teacherlists.Length; i++)
- {
- commandString = "SELECT tea_name FROM tea_table where tea_id=" + teacherlists.Substring(beginIndex, 8);
- SqlCommand cmd4 = new SqlCommand(commandString, connection);
- SqlDataReader sdr4 = cmd4.ExecuteReader();
- if (sdr4.Read())
- {
- if (0 == beginIndex)
- {
- Label7.Text = sdr4.GetValue(0).ToString();
- }
- else
- {
- Label7.Text += ", ";
- Label7.Text += sdr4.GetValue(0).ToString();
- }
- }
- sdr4.Close();
- beginIndex += 9;
- }
- 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 = " + userId;
- SqlCommand cmd7 = new SqlCommand(commandString, connection);
- SqlDataReader sdr7 = cmd7.ExecuteReader();
- if (sdr7.Read())
- {
- Label3.Text = sdr7.GetValue(0).ToString();
- }
- sdr7.Close();
- connection.Close();
- }
- }