In eclipse as soon as i type this out:
BaseColumns._ID, + "=?"
I get:
The operator + is undefined for the argument type(s) String
How is that possible, they are both Strings aren't they?
now here is documentation for BaseColumns._ID:
public static final String _ID
the code I am writin开发者_如何学Pythong is:
public void deteleProfile(Long id) throws SQLException {
SQLiteDatabase db = helper.getWritableDatabase();
Integer i = db.delete(ProlificDatabase.TABLE, BaseColumns._ID, + "=?", new String[] {id.toString()});
Log.d(TAG, i + " records deleted where id is " + id);
You've got a rogue comma:
BaseColumns._ID, + "=?"
should probably be
BaseColumns._ID + "=?
Otherwise it's trying to use + "=?"
as a stand-alone argument with the +
acting as a unary operator.
Do you mean BaseColumns._ID + "=?"
instead of BaseColumns._ID, + "=?"
?
The compiler just sees the left hand side of the +
operator as being empty.
See this documentation on how to use the db.delete method. Instead of BaseColumns._ID, + "=?" - you should be doing this:
Integer i = db.delete(ProlificDatabase.TABLE, BaseColumns._ID + "=?", new String[] {id.toString()});
Lovely extra ,
(comma)... love the commas for what they are, meaning a separator between expressions and a pain ... for when you overlook them!
精彩评论