Unable to Update Sqlite Database in Windows Phone Application -


in windows phone application, using sqlite database. able retrieve data "read only" exception while trying add/update data. using below code

public async void updatefavquote(int quoteid, string option)         {             var connection = new sqliteasyncconnection(_dbpath);              if (option == "add")             {                 await connection.executeasync("update quotes set isfav = 1 _id =" + quoteid);             }             else             {                 await connection.executeasync("update quotes set isfav = 0 _id =" + quoteid);             }                       } 

when run application on emulator/device, works fine, once app gets published store, start getting error. tried using below code gives same error

public void updatefavquote(int quoteid, string option)         {             var connection = new sqliteconnection(_dbpath, sqliteopenflags.readwrite);              if (option == "add")             {                 connection.runintransaction(() =>                 {                   connection.execute("update quotes set isfav = 1 _id =" + quoteid);                 });             }             else             {                 connection.runintransaction(() =>                 {                    connection.execute("update quotes set isfav = 0 _id =" + quoteid);                 });             }                      } 

this gives same issue once app published. appreciated.

you cannot write application package, it's read-only. you'll need copy data file local storage becomes writable. there's sample here follow.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -