2011-03-07 90 views
0

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

简单地说,我有:

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

我得-1。

回答

1

使用insertOrThrow可以获得更好的调试信息。我的心理调试能力表示,您没有正确实例化mDb使用数据库打开帮助器上的可写方法。