首页 新闻 会员 周边

mvc RedirectToAction 问题,在线卧等

0
悬赏园豆:20 [已关闭问题] 关闭于 2013-08-02 08:46
   [HttpPost]
         public ActionResult ShowEdit(ProductShow p)
         {
             try
             {
                 string sql = "update productshow set title=@title,description=@description,img=@img,dates=@dates where id="+p.id+" ";
                 OleDbParameter[] pare = new OleDbParameter[] { new OleDbParameter("@title", p.title),
                new OleDbParameter("@description", p.description),
                new OleDbParameter("@img", p.img),
                new OleDbParameter("@dates", DateTime.Now.ToShortDateString())};
                 int re = access.ExecuteNonQuery(sql, pare);
                 if (re > 0)
                 {
                     return RedirectToAction("Show");
                 }
             }
             catch (Exception)
             {
                 return View(p);
                 throw;
             }
             return View(p);
         }

这是修改的action方法,为什么跳到show页面以后 ,内容还是上一次的内容,如果F5刷新数据才是最新的,难道,重定向没有show方法中吗,或者是缓存问题。如果我在show的action中加断点,内容会刷新的,也就是说一切正常,

懒胖gg的主页 懒胖gg | 初学一级 | 园豆:144
提问于:2013-07-26 10:33
< >
分享
所有回答(1)
0

把show的那个Action方法贴出来看看

小兵仔 | 园豆:1240 (小虾三级) | 2013-07-26 13:41
        public ViewResult Show()
        {
            //Response.Write("<script>alert(33)</script>");
            string sql = "select * from productshow order by dates";
            DataTable dt = access.ExecuteDataTable(sql);
            if (dt != null)
            {
                return View(dt);
            }

            return View();
        }

不好意思,没有及时回复

支持(0) 反对(0) 懒胖gg | 园豆:144 (初学一级) | 2013-07-26 16:01

@fly in ocean:你这就是一个查询也参数,如果数据库没更新数据的话,每次查询出的数据都一样啊

支持(0) 反对(0) 小兵仔 | 园豆:1240 (小虾三级) | 2013-07-26 16:14

@zhanghb: 

恩,我知道,但是数据库里的值是更新了的

支持(0) 反对(0) 懒胖gg | 园豆:144 (初学一级) | 2013-07-26 17:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册