protected void Page_Load(object sender, EventArgs e) { int id = Request["id"] == null ? 0 : int.Parse(Request["id"]); BLL.ArticleManagement article = new BLL.ArticleManagement(); Model.ArticleManagement model = new Model.ArticleManagement(); model = article.GetModel(id); title = model.Title; keyword = model.Keyword; contents = model.Content; image = model.Image; time = Convert.ToDateTime(model.Uploadtime).ToString("yyyy-mm-dd"); }
protected void Page_Load(object sender, EventArgs e) { int id = Request["id"] == null ? 0 : int.Parse(Request["id"]); BLL.ArticleManagement management = new BLL.ArticleManagement(); Model.ArticleManagement model; model = management.GetModel(id); Content = model.Content; title = model.Title; Keyword = model.Keyword; DateTime?time = model.Uploadtime; //因为数据库中有可能时间为空,所以用 datetiem?类型 Time = Convert.ToDateTime(time).ToString("yyyy-MM-dd"); //转化成约定的时间格式 //Response.Write(model.Content); 避免respons.write的方式,因为它不可控制 //DataSet ds = management.GetList(" id="+id.ToString()); //Response.Write(ds.Tables[0].Rows[0][3]); }