index.aspx.cs
资源名称:MEIMS.rar [点击查看]
上传用户:ah_jiwei
上传日期:2022-07-24
资源大小:54044k
文件大小:2k
源码类别:
数据库编程
开发平台:
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 teacher_index : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- // string userId = Session["userId"].ToString();
- string userId = "20080005";
- string teacherlist="";
- string commandString = "select stu_id_num.stu_id,stu_id_num.stu_name from stu_id_num,stu_tea where stu_id_num.stu_id = stu_tea.sut_id and stu_tea.tea_id = " + userId;
- SqlDataSource1.SelectCommand = commandString;
- GridView1.DataBind();
- DataTable dt = new DataTable();
- SqlConnection connection = DB.connect_la();
- connection.Open();
- commandString = "select rep_to_arg.*,stu_name from rep_to_arg,stu_id_num where (stu_id_num.stu_id = rep_to_arg.stu_id)";
- SqlCommand cmd = new SqlCommand(commandString, connection);
- SqlDataAdapter sda = new SqlDataAdapter(cmd);
- sda.Fill(dt);
- foreach (DataRow dr in dt.Rows)
- {
- if (!dr["arg_tea_id"].ToString().Contains(userId))
- dr.Delete();
- }
- GridView3.DataSourceID = "";
- GridView3.DataSource = dt;
- GridView3.DataBind();
- //sdr.Close();
- connection.Close();
- }
- //选择学生
- protected void Button1_Click(object sender, EventArgs e)
- {
- Response.Write("<script>alert('提交成功!');window.location='index.aspx'</script>");
- }
- }