Android SQLite returns -1
I'm new here, and I'm working on my first android applicatio开发者_运维知识库n for class. Every time I use mDb.insert(), I get "-1" returned.
In brief, I have:
private SQLiteDatabase mDb;
ContentValues intialValues; //I then .put() some stuff into intialValues
return mDb.insert("mytable", null, initialValues);
And I get -1.
Use insertOrThrow
to get better debugging information. My psychic debugging powers say that you did not properly instantiate mDb
using the writable method on the database open helper.
精彩评论