protected void Page_Load(object sender, EventArgs e)
        {
            this.userId = Convert.ToInt32(Session["userID"].ToString());
            if (!IsPostBack)
            {
                string    sql1 = "select * from province";
                DataSet   ds1  = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql1);
                DataTable dt1  = ds1.Tables[0];
                DDLprovince.DataSource = dt1;
                DDLprovince.DataBind();

                string    sql2 = "select * from school";
                DataSet   ds2  = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql2);
                DataTable dt2  = ds2.Tables[0];
                DDLschool.DataSource = dt2;
                DDLschool.DataBind();

                string    sql3 = "select * from grade";
                DataSet   ds3  = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql3);
                DataTable dt3  = ds3.Tables[0];
                DDLgrade.DataSource = dt3;
                DDLgrade.DataBind();
            }
            this.userName = Session["userName"].ToString();
            this.id       = Session["userID"].ToString();
            string    sql = "select * from users where id=@id";
            DataSet   ds  = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql, new MySqlParameter("@id", id));
            DataTable dt  = ds.Tables[0];
            string    img = dt.Rows[0]["logo"].ToString();

            pic.ImageUrl     = img;
            pic_mid.ImageUrl = img;
            pic_s.ImageUrl   = img;
        }
示例#2
0
        /// <summary>
        /// 绑定 省 年纪 学校的方法
        /// </summary>
        protected void DDLbind()
        {
            string    sql1 = "select * from province";
            DataSet   ds1  = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql1);
            DataTable dt1  = ds1.Tables[0];

            DDLprovince.DataSource = dt1;
            DDLprovince.DataBind();

            string    sql2 = "select * from school";
            DataSet   ds2  = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql2);
            DataTable dt2  = ds2.Tables[0];

            DDLschool.DataSource = dt2;
            DDLschool.DataBind();

            string    sql3 = "select * from grade";
            DataSet   ds3  = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, sql3);
            DataTable dt3  = ds3.Tables[0];

            DDLgrade.DataSource = dt3;
            DDLgrade.DataBind();
        }