jeudi 10 mars 2016

My SQLite Update statement keeps inserting 0 into the first field and the correct values after that

I am facing a really annoying bug which is that it keeps inputting a 0 into the first column and then the rest of the values after.

This is my code:

System.out.println(forename);
String statement = "UPDATE " + USER_TABLE + " SET " + FORENAME + " = " + "'" + forename + "'"
+ " AND " + SURNAME + " = " + "'" + surname + "'" + " AND " + EMAIL + " = " + "'" + email + "'"  
+ "WHERE " + USER_ID + " = " + userID;
sqLiteDatabase.execSQL(statement);

So if forename was Luke it would print Luke but then after running this query the table would look like this:

UserID  |  Forename   |  Surname   | Email
____________________________________________

1            0           Smith        luke@s.com

As you can see Luke was not put into the Forename field despite the fact that I can clearly see the value Luke being printed in LogCat

Aucun commentaire:

Enregistrer un commentaire