Android Sqlite database is not updating the data?? -


i using code update values

this code working without error there no error in query when show data after updating showing old data??

this code using updating data in sqlite.

  @override     public void onclick(view v) {         if (v == update) {             try {                 contentvalues cv = new contentvalues();                 cv.put("cname", editname.gettext().tostring());                 cv.put("mobileno", editmobile.gettext().tostring());                 cv.put("phone", editlandline.gettext().tostring());                 cv.put("address", editaddress.gettext().tostring());                 cv.put("email", editemail.gettext().tostring());                 cv.put("picture", editbytes);                 db.update("contacts", cv, "cname=" + v,null);                  intent = new intent(ctx, contactlist.class);                 ctx.startactivity(i);                   // db.execsql("insert contacts values('" + name.gettext() + "','" + mobile.gettext() + "','" + phone.gettext() + "','" + add.gettext() + "','" + email.gettext() + "')");                 toast.maketext(ctx, "contact updated...",toast.length_long).show();              } catch (exception e) {                 toast.maketext(ctx, "fail update contact.." + e, toast.length_long).show();              }          } else if (v == delete) {          }     } 

can please try this,

db.update("contacts", cv, "cname=" + v,null); 

what v, particular name , thingk, may try udapte using id, more effective.

change to

sqlitedatabase db = dbhelper.getwritabledatabase(); db.update("contacts", cv, "cid=" + "=" + id, null); db.close(); // closing database connection 

however, if don't update, please clean project , rebuild, might work.if not help, please post logcat.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -