I have successfully added a blob file into my database. but when i try to update it gives errors. I tried two methods here is my code.I searched but everywhere i found adding in database not updating a byte[].
1- First i tried to save simple pro byte[]. but it said it didn't recognize the value of byte[].
2- Then i tried Arrays.toString(pro) but no such column.
public void profile(String status,byte[] pro, SQLiteDatabase db){
ContentValues sv = new ContentValues();
sv.put(mDatabase.Tableinfo.status, status);
sv.put(mDatabase.Tableinfo.Pic, pro) ;
db.update(mDatabase.Tableinfo.Table_Name, sv, mDatabase.Tableinfo.status + "=" + status + " and " + mDatabase.Tableinfo.Pic + "=" + Arrays.toString(pro), null);
// db.insert(mDatabase.Tableinfo.Table_Name, null, sv);
android.database.sqlite.SQLiteException: near "and": syntax error (code 1): , while compiling: UPDATE User SET status=?,Pro_pic=? WHERE status= and Pro_pic=[-119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 120, 0, 0, 0, 1............ and to infinite .
Aucun commentaire:
Enregistrer un commentaire