error with inserting data into sqlite database table in android
I have a db table :
create table recentMovies5 (_id integer开发者_开发知识库 primary key autoincrement, line1 text, line2 text, title text , Tags text , ImageLink text , XMLLink text, entryTime numeric);
and am inserting values like this:
Insert into recentMovies5 (line1, line2, title, Tags,ImageLink,XMLLink,entryTime) Values ("3 min ", "Japan", "Ahsan", "38", "www.ahsan.com/aha.jpg", "www.ahsan.com/aha.xml",1317172213);
java code for inserting:
String select="Insert into recentMovies5 (line1, line2, title, Tags,ImageLink,XMLLink,entryTime) Values (\"3 min \", \"Japan\", \"Ahsan\", \"38\", \"www.ahsan.com/aha.jpg\", \"www.ahsan.com/aha.xml\",1317172213)";
SQLiteDatabase db = savedInfoDbHelper.getReadableDatabase();
Cursor c=db.rawQuery(select, null);
startManagingCursor(c);
before I added the column entryTime numeric
, everything was working fine. Now, no data is being inserted and I get no error message! Any help ?
edit 1: changing entryTime from numeric
to integer
doesnt seem to help :(
edit 2: using this code to open the database:
public SavedMoviesDbAdapter open() throws SQLException {
dbHelper = new RecentMovieDatabaseHelper(context);
database = dbHelper.getWritableDatabase();
return this;
}
edit 3: checked with both isOpen and isReadOnly =>> is open and not readonly.
You are trying to insert into a readable only DB.
Use openDatabase with OPEN_READWRITE
flag instead.
精彩评论