I'm sure there are lots of similar question but my context is kinda different.
So i'm working on an android app and i'm inserting data into a table. Let's say the table name is user with columns firstname and lastname which are of type text.
I run an insert function to insert a row into the table but with information for just firstname. So firstname is inserted and lastname is empty. Now here come the problem.
When I try to update the column lastname, it doesn't work. I don't know if it's cos it empty or null.
My update code looks something like
int result = db.update(TABLE_USER, contentvalue, "_id= someValue", null);
Result is usually 0. Contentvalue contains lastname and I can guarantee it's not empty.
I don't know if during the first insert, it's mandatory to set the value of the last to null or empty and not let the db handle that cos it works if I do. Any suggestion is appreciated and i'ld like to know why it doesn't work too. Thanks
_id? did you debug/log the valuesomeValue? is it correct? did you make sure that the row is actually inserted? otherwise you will be updating a row that does not exist