Пример #1
0
 /// <summary>
 /// Page_Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //判断是否存在该id的公告
         int id = int.Parse(Request.QueryString["id"].ToString());
         AnnouncementEntity ae = AnnouncementOperation.GetAM(int.Parse(Request.QueryString["id"].ToString()));
         if (ae == null)
         {
             SmallScript.MessageBox(Page, "不存在该公告!点击返回!");
             SmallScript.GoBack(Page);
             return;
         }
         else
         {
             //在表单中显示数据
             DataBase db   = new DataBase();
             DataSet  sql  = db.ExCommand(string.Format("SELECT tb_announcement.id, tb_announcement.uid, tb_announcement.amtitle, tb_announcement.essay, tb_announcement.uptime, tb_user.userName FROM  tb_announcement INNER JOIN  tb_user ON tb_announcement.uid = tb_user.id  WHERE (tb_announcement.id ={0} )", id));
             string   User = sql.Tables[0].Rows[0]["userName"].ToString();
             lb_ID.Text      = ae.Id.ToString();
             tb_amtitle.Text = ae.AmTitle;
             lb_User.Text    = User;
             lb_essay.Text   = ae.Essay;
             lb_UpTime.Text  = ae.Time.ToString();
         }
     }
 }
Пример #2
0
    /// <summary>
    /// Page_Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            AnnouncementEntity ae = AnnouncementOperation.GetAM(int.Parse(Request.QueryString["id"].ToString()));

            if (ae != null)
            {
                DataBase db   = new DataBase();
                DataSet  sql  = db.ExCommand(string.Format("SELECT tb_announcement.id, tb_announcement.uid, tb_announcement.amtitle, tb_announcement.essay, tb_announcement.uptime, tb_user.userName FROM  tb_announcement INNER JOIN  tb_user ON tb_announcement.uid = tb_user.id  WHERE (tb_announcement.id ={0} ) ", id));
                string   User = sql.Tables[0].Rows[0]["userName"].ToString();
                //在表单中显示数据
                lb_Id.Text      = ae.Id.ToString();
                lb_amtitle.Text = ae.AmTitle;
                lb_User.Text    = User;
                lb_UpTime.Text  = ae.Time.ToString();
                lb_essay.Text   = ae.Essay;
            }
        }
    }