简体   繁体   中英

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.

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:

if(!page.postback)
     {
         //your select syntax
     }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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