protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { sqlHelp sqlhelper = new sqlHelp(); string teaid = Session["teaidedit"].ToString(); string selectsql = "select * from teacherInfo where id='" + teaid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); TextBox1.Text = db.Rows[0]["teaNum"].ToString(); TextBox2.Text = db.Rows[0]["teaName"].ToString(); TextBox3.Text = db.Rows[0]["teaSex"].ToString(); TextBox4.Text = db.Rows[0]["teaID"].ToString(); TextBox5.Text = db.Rows[0]["teaNational"].ToString(); TextBox6.Text = db.Rows[0]["teaTel"].ToString(); TextBox7.Text = db.Rows[0]["teaChangerequest"].ToString(); string selectdepartment = "select * from departmentInfo"; DataTable db2 = sqlhelper.dataTableReturn(selectdepartment); DropDownList1.DataSource = db2; DropDownList1.DataTextField = "departmentName"; DropDownList1.DataValueField = "departmentName"; DropDownList1.DataBind(); DropDownList1.Text = db.Rows[0]["teaDepartment"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { sqlHelp sqlhelper = new sqlHelp(); string stuid = Session["stuidedit"].ToString(); string selectsql = "select * from studentInfo where id='" + stuid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); TextBox1.Text = db.Rows[0]["stuNum"].ToString(); TextBox2.Text = db.Rows[0]["stuName"].ToString(); TextBox3.Text = db.Rows[0]["stuSex"].ToString(); TextBox4.Text = db.Rows[0]["stuID"].ToString(); TextBox5.Text = db.Rows[0]["stuNational"].ToString(); TextBox6.Text = db.Rows[0]["stuTel"].ToString(); TextBox7.Text = db.Rows[0]["stuChangerequest"].ToString(); //string selectcollege = "select * from collegeInfo"; //DataTable db2 = sqlhelper.dataTableReturn(selectcollege); //DropDownList1.DataSource = db2; //DropDownList1.DataTextField = "collegeName"; //DropDownList1.DataValueField = "collegeName"; //DropDownList1.DataBind(); //DropDownList1.Text = db.Rows[0]["stuCollege"].ToString(); //string selectclass = "select * from classInfo"; //DataTable db3 = sqlhelper.dataTableReturn(selectclass); //DropDownList2.DataSource = db3; //DropDownList2.DataTextField = "className"; //DropDownList2.DataValueField = "className"; //DropDownList2.DataBind(); //DropDownList2.Text = db.Rows[0]["stuClass"].ToString(); GetDropDownList1(); GetDropDownList2(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { sqlHelp sqlhelper = new sqlHelp(); string stuid = Session["stuid"].ToString(); string selectsql = "select * from studentInfo where id='" + stuid + "'"; DataTable dt = sqlhelper.dataTableReturn(selectsql); Label1.Text = dt.Rows[0]["stuNum"].ToString(); Label2.Text = dt.Rows[0]["stuName"].ToString(); Label3.Text = dt.Rows[0]["stuSex"].ToString(); Label4.Text = dt.Rows[0]["stuID"].ToString(); Label5.Text = dt.Rows[0]["stuNational"].ToString(); Label6.Text = dt.Rows[0]["stuTel"].ToString(); Label7.Text = dt.Rows[0]["stuCollege"].ToString(); Label8.Text = dt.Rows[0]["stuClass"].ToString(); if (dt.Rows[0]["stuChangerequest"].ToString() == "") { Label9.Text = "该用户未提交变更请求"; } else { Label9.Text = dt.Rows[0]["stuChangerequest"].ToString(); } Image1.ImageUrl = "~/" + dt.Rows[0]["stuPic"].ToString(); } }
protected void LinkButton1_Click(object sender, EventArgs e) { Session["classid"] = 39; sqlHelp sqlhelper = new sqlHelp(); string classid = Session["classid"].ToString(); string selectsql = "select * from classInfo where id='" + classid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); string oldName = db.Rows[0]["className"].ToString(); string classNewName = TextBox1.Text.ToString(); string collegeNewName = DropDownList1.Text; string updatesql1 = "update classInfo set className='" + classNewName + "'where id='" + classid + "'"; sqlhelper.SqlServerExcute(updatesql1); string updatesql11 = "update classInfo set collegeName='" + collegeNewName + "'where id='" + classid + "'"; sqlhelper.SqlServerExcute(updatesql11); string updatesql2 = "update studentInfo set stuClass='" + classNewName + "'where stuClass='" + oldName + "'"; sqlhelper.SqlServerExcute(updatesql2); string updatesql22 = "update studentInfo set stuCollege='" + collegeNewName + "'where stuClass='" + classNewName + "'"; sqlhelper.SqlServerExcute(updatesql22); Response.Write("<Script>alert('信息修改成功!');</script>"); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { string collegeid = Convert.ToString(e.CommandArgument); sqlHelp sqlhelper = new sqlHelp(); if (e.CommandName == "del") { string selectcollegename = "select * from collegeInfo where id='" + collegeid + "'"; DataTable db1 = sqlhelper.dataTableReturn(selectcollegename); string collegename = db1.Rows[0]["collegeName"].ToString(); string delclass = "delete from classInfo where collegeName='" + collegename + "'"; sqlhelper.SqlServerExcute(delclass); string delstu = "delete from studentInfo where stuCollege='" + collegename + "'"; sqlhelper.SqlServerExcute(delstu); string deletesql = "delete from collegeInfo where id='" + collegeid + "'"; sqlhelper.SqlServerExcute(deletesql); Response.Write("<script>alert('学院删除成功!请刷新查看');</script>"); } else if (e.CommandName == "edit") { Session["collegeid"] = collegeid; Response.Redirect("Modifycollege.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["id"]; //string id = "72"; if (id != "") { sqlHelp sqlhelper = new sqlHelp(); string selectsql = "select * from studentInfo where id='" + id + "'"; DataTable dt = sqlhelper.dataTableReturn(selectsql); Label1.Text = dt.Rows[0]["stuNum"].ToString(); Label2.Text = dt.Rows[0]["stuName"].ToString(); Label3.Text = dt.Rows[0]["stuSex"].ToString(); Label4.Text = dt.Rows[0]["stuID"].ToString(); Label5.Text = dt.Rows[0]["stuNational"].ToString(); Label6.Text = dt.Rows[0]["stuTel"].ToString(); Label7.Text = dt.Rows[0]["stuCollege"].ToString(); Label8.Text = dt.Rows[0]["stuClass"].ToString(); if (dt.Rows[0]["stuChangerequest"].ToString() != null) { TextBox1.Text = dt.Rows[0]["stuChangerequest"].ToString(); } } } }
protected void Page_Load(object sender, EventArgs e) { sqlHelp sqlhelper = new sqlHelp(); string collegeid = Session["collegeid"].ToString(); string selectsql = "select * from collegeInfo where id='" + collegeid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); Label1.Text = db.Rows[0]["collegeName"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Session["classid"] = 39; sqlHelp sqlhelper = new sqlHelp(); string classid = Session["classid"].ToString(); string selectsql = "select * from classInfo where id='" + classid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); Label1.Text = db.Rows[0]["className"].ToString(); string selectsql2 = "select * from collegeInfo"; DataTable db2 = sqlhelper.dataTableReturn(selectsql2); DropDownList1.DataSource = db2; DropDownList1.DataTextField = "collegeName"; DropDownList1.DataValueField = "collegeName"; DropDownList1.DataBind(); } }
protected void showDropDownList1() { sqlHelp sqlhelp = new sqlHelp(); string selectSql = "select * from inquireObjectInfo"; DataTable db = sqlhelp.dataTableReturn(selectSql); DropDownList1.DataSource = db; DropDownList1.DataTextField = "inquireObject"; DropDownList1.DataValueField = "inquireObject"; DropDownList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { sqlHelp sqlhelper = new sqlHelp(); string selectsql = "select * from teacherInfo"; DataTable db = sqlhelper.dataTableReturn(selectsql); GridView1.DataSource = db; GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // Session["departmentid"]=1; sqlHelp sqlhelper = new sqlHelp(); string departmentid = Session["departmentid"].ToString(); // Response.Write(departmentid); string selectsql = "select * from departmentInfo where id='" + departmentid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); Label1.Text = db.Rows[0]["departmentName"].ToString(); }
protected void showDropDownList2() { sqlHelp sqlhelp = new sqlHelp(); string selectSql = "select * from inquiryModeInfo where type in('" + 0 + "','" + 1 + "')";//默认设置为查询学生 DataTable db = sqlhelp.dataTableReturn(selectSql); DropDownList2.DataSource = db; DropDownList2.DataTextField = "inquiryMode"; DropDownList2.DataValueField = "inquiryMode"; DropDownList2.DataBind(); }
private void GetDropDownList1() { sqlHelp sqlhelper = new sqlHelp(); string selectsql = "select * from collegeInfo"; DataTable db = sqlhelper.dataTableReturn(selectsql); DropDownList1.DataSource = db; DropDownList1.DataTextField = "collegeName"; DropDownList1.DataValueField = "collegeName"; DropDownList1.DataBind(); // DropDownList1.SelectedIndex = db.Rows.Count; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { sqlHelp sqlhelper = new sqlHelp(); string selectsql = "select * from collegeInfo"; DataTable db = new DataTable(); db = sqlhelper.dataTableReturn(selectsql); DropDownList1.DataSource = db; DropDownList1.DataTextField = "collegeName"; DropDownList1.DataValueField = "collegeName"; DropDownList1.DataBind(); string selectsql2 = "select * from classInfo"; DataTable db2 = new DataTable(); db2 = sqlhelper.dataTableReturn(selectsql2); GridView1.DataSource = db2; GridView1.DataBind(); } }
private void GetDropDownList2() { string collegename = this.DropDownList1.SelectedValue.ToString(); sqlHelp sqlhelper = new sqlHelp(); string selectsql = "select * from classInfo where collegeName='" + collegename + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); DropDownList2.DataSource = db; DropDownList2.DataTextField = "className"; DropDownList2.DataValueField = "className"; DropDownList2.DataBind(); // DropDownList2.SelectedIndex = db.Rows.Count; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { sqlHelp sqlhelper = new sqlHelp(); string selectsql = "select * from departmentInfo"; DataTable db = new DataTable(); db = sqlhelper.dataTableReturn(selectsql); DropDownList1.DataSource = db; DropDownList1.DataTextField = "departmentName"; DropDownList1.DataValueField = "departmentName"; DropDownList1.DataBind(); } }
protected void LinkButton1_Click(object sender, EventArgs e) { //Session["departmentid"] = 1; sqlHelp sqlhelper = new sqlHelp(); string departmentid = Session["departmentid"].ToString(); string selectsql = "select * from departmentInfo where id='" + departmentid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); string oldName = db.Rows[0]["departmentName"].ToString(); string departmentNewName = TextBox1.Text.ToString(); string updatesql1 = "update departmentInfo set departmentName='" + departmentNewName + "'where id='" + departmentid + "'"; sqlhelper.SqlServerExcute(updatesql1); string updatesql2 = "update teacherInfo set teaDepartment='" + departmentNewName + "'where teaDepartment='" + oldName + "'"; sqlhelper.SqlServerExcute(updatesql2); Response.Write("<Script>alert('信息修改成功!');</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["id"]; if (id != "") { sqlHelp sqlhelper = new sqlHelp(); string selectsql = "select * from teacherInfo where id='" + id + "'"; DataTable dt = sqlhelper.dataTableReturn(selectsql); Label1.Text = dt.Rows[0]["teaNum"].ToString(); Label2.Text = dt.Rows[0]["teaName"].ToString(); Label3.Text = dt.Rows[0]["teaSex"].ToString(); Label4.Text = dt.Rows[0]["teaID"].ToString(); Label5.Text = dt.Rows[0]["teaNational"].ToString(); Label6.Text = dt.Rows[0]["teaTel"].ToString(); Label7.Text = dt.Rows[0]["teaDepartment"].ToString(); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { string departmentid = Convert.ToString(e.CommandArgument); sqlHelp sqlhelper = new sqlHelp(); if (e.CommandName == "del") { string selectsql = "select * from departmentInfo where id='" + departmentid + "'"; DataTable db = sqlhelper.dataTableReturn(selectsql); string departname = db.Rows[0]["departmentName"].ToString(); string deletetea = "delete from teacherInfo where teaDepartment='" + departname + "'"; sqlhelper.SqlServerExcute(deletetea); string deletesql = "delete from departmentInfo where id='" + departmentid + "'"; sqlhelper.SqlServerExcute(deletesql); Response.Write("<script>alert('部门删除成功!请刷新查看');</script>"); } else if (e.CommandName == "edit") { Session["departmentid"] = departmentid; Response.Redirect("ModifyDepartment.aspx"); } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { string object1 = DropDownList1.SelectedValue.ToString(); string myselectsql = ""; if (object1 == "教师") { myselectsql = "select * from inquiryModeInfo where type in('" + 0 + "','" + 2 + "')"; } else if (object1 == "学生") { myselectsql = "select * from inquiryModeInfo where type in('" + 0 + "','" + 1 + "')"; } //Response.Write(object1); sqlHelp sqlhelp = new sqlHelp(); DataTable db = sqlhelp.dataTableReturn(myselectsql); DropDownList2.DataSource = db; DropDownList2.DataTextField = "inquiryMode"; DropDownList2.DataValueField = "inquiryMode"; DropDownList2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //邮箱下拉菜单 sqlHelp sqlhelp1 = new sqlHelp(); string selectEmailSql = "select * from emailTab"; DataTable db1 = sqlhelp1.dataTableReturn(selectEmailSql); DropDownList1.DataSource = db1; DropDownList1.DataTextField = "email"; DropDownList1.DataValueField = "email"; DropDownList1.DataBind(); //师院要闻 sqlHelp sqlhelp2 = new sqlHelp(); string selectNews1Sql = "select top 9 * from newsTab where type=1 order by id desc"; DataTable db2 = sqlhelp2.dataTableReturn(selectNews1Sql); GridView1.DataSource = db2; GridView1.DataBind(); //院校动态 sqlHelp sqlhelp3 = new sqlHelp(); string selectDynamic1Sql = "select top 9 * from newsTab where type=2 order by id desc"; DataTable db3 = sqlhelp3.dataTableReturn(selectDynamic1Sql); GridView2.DataSource = db3; GridView2.DataBind(); sqlHelp sqlhelp4 = new sqlHelp(); string selectRightNewsSql = "select top 14 * from newsTab where type=3 order by id desc"; DataTable db4 = sqlhelp4.dataTableReturn(selectRightNewsSql); GridView3.DataSource = db4; GridView3.DataBind(); }