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

数据库编程

开发平台:

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_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.             Label1.Text = sdr.GetValue(1).ToString();
  25.             Label3.Text = sdr.GetValue(27).ToString();
  26.             if (sdr.GetInt32(3) == 0)
  27.                 Label2.Text = "男";
  28.             else
  29.                 Label2.Text = "女";
  30.             Label4.Text = sdr.GetValue(13).ToString();
  31.             Label6.Text = sdr.GetValue(7).ToString();
  32.             string path = sdr.GetValue(12).ToString();
  33.             Image1.ImageUrl = sdr.GetValue(12).ToString();
  34.            
  35.         }
  36.         sdr.Close();
  37.         commandString = "SELECT avg_point FROM stu_id_num WHERE  stu_id_num.stu_id=" + stu_ID;
  38.         SqlCommand cmd1 = new SqlCommand(commandString, connection);
  39.         SqlDataReader sdr1 = cmd1.ExecuteReader();
  40.         if (sdr1.Read())
  41.         {
  42.            
  43.             Label5.Text = sdr1.GetDecimal(0).ToString();
  44.         }
  45.         sdr1.Close();
  46.         connection.Close();
  47.     }
  48. }