Android SQLite返回-1

时间:2011-03-07 03:15:37

标签: android sqlite

我是新来的,我正在研究我的第一个Android应用程序。每次我使用mDb.insert()时,都会返回“-1”。

简而言之,我有:

private SQLiteDatabase mDb;
ContentValues intialValues; //I then .put() some stuff into intialValues 
return mDb.insert("mytable", null, initialValues);

我得-1。

1 个答案:

答案 0 :(得分:1)

使用insertOrThrow获取更好的调试信息。我的通灵调试权表示你没有使用数据库打开助手上的可写方法正确实例化mDb