Example #1
0
    private void Page_Load(object sender, System.EventArgs e)
    {
        //   在此处放置用户代码以初始化页面
        if (!IsPostBack)
        {
            //this.TxtStartTime.Attributes.Add("onfocus", "javascript:calendar()");
            //this.TxtEndTime.Attributes.Add("onfocus", "javascript:calendar()");
            string        connstr   = ConfigurationManager.ConnectionStrings["Mispersonalconn"].ConnectionString;
            SqlConnection Sqlconn   = new SqlConnection(connstr);
            DataSet       ds        = new DataSet();
            string        Personstr = "select E_ID,E_Name from Tb_employee order by E_ID desc";
            string        Kindstr   = "select L_ID,L_Kind from Tb_leaver_kind order by L_ID desc";
            string        Agreerstr = "select D_ID,D_Chief from Tb_department order by D_ID desc";
            //读取考勤字段
            SqlDataAdapter SqlPerson = new SqlDataAdapter(Personstr, Sqlconn);
            SqlDataAdapter SqlKind   = new SqlDataAdapter(Kindstr, Sqlconn);
            SqlDataAdapter SqlAgreer = new SqlDataAdapter(Agreerstr, Sqlconn);
            Sqlconn.Open();

            SqlPerson.Fill(ds, "Person");
            Person.DataSource     = ds.Tables["Person"].DefaultView;
            Person.DataTextField  = "E_Name";
            Person.DataValueField = "E_ID";
            Person.DataBind();

            SqlKind.Fill(ds, "Kind");
            Kind.DataSource     = ds.Tables["Kind"].DefaultView;
            Kind.DataTextField  = "L_Kind";
            Kind.DataValueField = "L_ID";
            Kind.DataBind();

            SqlAgreer.Fill(ds, "Agreer");
            Agreer.DataSource     = ds.Tables["Agreer"].DefaultView;
            Agreer.DataTextField  = "D_Chief";
            Agreer.DataValueField = "D_ID";
            Agreer.DataBind();
            Sqlconn.Close();
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id   = Request["E_ID"];
            string name = Request["E_Name"];
            Session["E_ID"]   = id;
            Session["E_Name"] = name;
            Bond();

            string         connstr   = ConfigurationManager.ConnectionStrings["Mispersonalconn"].ConnectionString;
            SqlConnection  Sqlconn   = new SqlConnection(connstr);
            DataSet        ds        = new DataSet();
            string         Agreerstr = "select D_ID,D_Name from Tb_department order by D_ID desc";
            SqlDataAdapter SqlAgreer = new SqlDataAdapter(Agreerstr, Sqlconn);
            SqlAgreer.Fill(ds, "Agreer");
            Agreer.DataSource     = ds.Tables["Agreer"].DefaultView;
            Agreer.DataTextField  = "D_Name";
            Agreer.DataValueField = "D_ID";
            Agreer.DataBind();
            Sqlconn.Close();
        }
    }