SQLiteException: no such table

2019-02-14 08:09发布

I am using my own SQLite3 database as opposed to creating a new one each time my app runs, as I have a few tables with static data that I am trying to display. I created my database and placed it in my assets folder. I then created my database helper and when I start my app I can open my database without problem but when I try to open my first table using the following code

private Cursor getData() 
{
    try
    {
        myDbHelper = new DatabaseHelper(this);
        SQLiteDatabase db = myDbHelper.getReadableDatabase();
        Cursor cursor = db.query("exhibitor", FROM, null, null, null,null, ORDER_BY);
        startManagingCursor(cursor);
        return cursor;
    }
    catch(SQLiteException e)
    {
        String err = e.toString();
        return null;
    }
}


It throws an error saying android.database.sqlite.SQLiteException: no such table: exhibitor: , while compiling: SELECT _id, EXHIBITOR FROM exhibitor ORDER BY EXHIBITOR but when I check the database exhibitor is there.

What am I missing?

7条回答
劳资没心,怎么记你
2楼-- · 2019-02-14 08:50

Clear Data and uninstall application from your device and re-install application in device...

Settings -> Applications -> Manage Applications -> Your Application Name -> Clear data
查看更多
登录 后发表回答