2015-09-04 183 views

回答

0

没有,但有一个insertOrThrow方法 - see the docs

它使用以下PARAMS:

public long insertOrThrow (String table, String nullColumnHack, ContentValues values) 
0

下面的代码工作对我很好,skd26。替换应该像大多数数据库中的插入一样起作用

if (comicBook == null) { 

    return false; 
} 

long id = -1; 

try { 

    id = mDatabase.replaceOrThrow(TABLE_NAME, null, generateContentValuesFromObject(comicBook)); 
} catch (SQLException e) { 
    Log.e("ComicBookFav", e.getMessage()); 
} 

return id != -1; 
相关问题