[英]How to update database using addon entity framework model?
I'm using TinyMCE to give me HTML Tags as the user desire, so I store them in database and call them later at the appropriate portion of the pages. 我使用TinyMCE来给我HTML标记,这是用户期望的,所以我将它们存储在数据库中,稍后在页面的适当位置调用它们。
Everything is working fine until I hit the update button, it tells me updated successfully but I find it send back the same old data. 一切正常,直到我按下“更新”按钮,它告诉我更新成功,但是我发现它发回了相同的旧数据。
This is the updating syntax I use 这是我使用的更新语法
int ID1 = int.Parse(Request.QueryString["titelid"]);
webmarketingEntities wme = new webmarketingEntities();
articls ar = new articls();
articls query = (from art in wme.articls
where art.id==ID1
select art).First();
ar.articalcontent = txtconteny.Text;
ar.pagedescription = txtdescription.Text;
ar.pagetitle = txttitle.Text;
wme.SaveChanges();
I figured the solution: 我想出了解决方案:
I should have written the select statement as following: 我应该将select语句编写如下:
if(!page.postback)
{
//your select syntax
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.