Student/Myinfo.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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_Myinfo : System.Web.UI.Page
{
    Alert alert = new Alert();
    data data = new data();
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList2.DataSource = data.GetDataReader("select * from  Xueyuan");
            DropDownList2.DataTextField = "Name";
            DropDownList2.DataValueField = "id";
            DropDownList2.DataBind();
            DropDownList3.DataSource = data.GetDataReader("select * from  zhuanye ");
            DropDownList3.DataTextField = "name";
            DropDownList3.DataValueField = "id";
            DropDownList3.DataBind();

            GetInfo();
        }
    }
    private void GetInfo()
    {

        SqlDataReader dr;
        dr = data.GetDataReader("select * from  Student where xuehao='" + Session["xuehao"] + "'");
        dr.Read();
        txtname.Text = dr["UserName"].ToString();

        txtemal.Text = dr["emal"].ToString();
        txtds.Text = dr["Ds"].ToString();

        DropDownList1.Items.FindByText(dr["Sex"].ToString()).Selected = true;
        DropDownList3.Items.FindByValue(dr["zhuanyeId"].ToString()).Selected = true;
        DropDownList3.Items.FindByText(dr["ZhuanyeName"].ToString()).Selected = true;
        DropDownList2.Items.FindByValue(dr["xueyuanId"].ToString()).Selected = true;
        DropDownList2.Items.FindByText(dr["XueyuanName"].ToString()).Selected = true;

        txtxuehao.Text = dr["xuehao"].ToString();
        txttime1.Value = dr["chushengriqi"].ToString();


    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {

        data.RunSql("update   Student set emal='" + txtemal.Text + "',UserName='" + txtname.Text + "',Ds='" + txtds.Text + "',Sex='" + DropDownList1.SelectedItem.Text + "',chushengriqi='" + txttime1.Value + "',zhuanyeId='" + DropDownList3.SelectedValue + "', ZhuanyeName='" + DropDownList3.SelectedItem.Text + "',xueyuanId='" + DropDownList2.SelectedValue + "',XueyuanName='" + DropDownList2.SelectedItem.Text + "'  where xuehao='" + Session["xuehao"] + "'");

        Alert.AlertAndRedirect("修改成功!", "Myinfo.aspx");
后面还有 9 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。