c# - Update & Insert into database using Odata service and linq -


i building windows-phone 8 app uses remote database. access database i've created odata dataservice (running on iis).

i have ready succeeded in retrieving data database using data service. want update , insert data database using service. how do using linq?

note: have read this

but cant link work allready have:

        private void mainpage_loaded(object sender, routedeventargs e)     {           var ctx = new measurmententities(new uri("http://192.168.11.240:85/nfcdataservice.svc/"));         var coll = new dataservicecollection<device>(ctx);          lst.itemssource = coll;          coll.loadcompleted += new eventhandler<loadcompletedeventargs>(coll_loadcompleted);          var query = g in ctx.devices                     g.deviceid > 2                     orderby g.devicename                     select g;           coll.loadasync(query);      }      void coll_loadcompleted(object sender, loadcompletedeventargs e)     {          if (e.error != null)         {             messagebox.show(e.error.tostring());         }      } 

something following add entity (i.e. insert record):

ctx.addtodevices(new device{...}); ctx.beginsavechanges(new asyncallback(r=>{      dataserviceresponse dsr = ctx.endsavechanges(r);      if (dsr.any(op => op.error != null))      {        //show error message      }      else      {        //succeeded      } },null); 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -