简体   繁体   English

手动更新数据库表值未反映在网页中-ASPNET MVC

[英]manually updating database table values are not reflecting in webpage - aspnet mvc

i noticed some wierd problem ie i have built a web page on which information comes from database table named "school", when i change some data in that table manually from mssql the web page data is still same as previous, its not gettin' changed, i dn't know how it is possible. 我注意到了一个比较棘手的问题,即我建立了一个网页,该网页上的信息来自名为“ school”的数据库表,当我从mssql手动更改该表中的某些数据时,该网页数据仍与以前相同,未更改,我不知道怎么可能。

this is my action controller 这是我的动作控制器


    public ActionResult SchoolDetails(string id,_ASI_School schoolDetails)
    {
            schoolDetails = SchoolRepository.GetSchoolById(id);
            return View(schoolDetails);
     }

This is my view 这是我的看法


    =Html.Encode(Model.SchoolName)
    = Html.Encode(Model.SchoolAddress) 
    = Html.Encode(Model.SchoolEmail) 

code for GetSchoolById().. GetSchoolById()的代码。


   private static ASIDataContext db = new ASIDataContext();
   public static _ASI_School GetSchoolById(string schoolId)
   {
            return db._ASI_Schools.SingleOrDefault(x => x.SchoolId == schoolId);
   }

try putting this above your SchoolDetails ActionResult 尝试将其放在您的SchoolDetails ActionResult上方

[OutputCache( Duration=0)]

MVC does some really nice server side caching as well that clearing the cache on the browser does not fix. MVC确实进行了一些非常好的服务器端缓存,因此无法解决在浏览器中清除缓存的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM