Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android.database.sqlite.SQLiteException: no such table [duplicate]

Tags:

android

ISSUE (LogCat)

sqlite returned: error code = 1, msg = no such table ...

android.database.sqlite.SQLiteException: no such table: ....

CODE

public void onCreate(SQLiteDatabase db) {
    Log.v("SQLAdapter","onCreate(SQLiteDatabase db)");
    db.execSQL("CREATE TABLE "+tablename
            +" ("
            +col1+ " TEXT PRIMARY KEY , "
            +col2+ " TEXT , "
            +col3+ " TEXT , "
            +col4+ " TEXT , "
            +col5+ " TEXT , "
            +col6+ " TEXT , "
            +col7+ " TEXT , "
            +col8+ " TEXT "
            +")");
    db.execSQL("CREATE TABLE "+configTable
            +" ("
            +colName+ " TEXT PRIMARY KEY , "
            +colValue+ " TEXT "
            +")");
    
    ContentValues cv=new ContentValues();
    cv.put(colName, "updated");
    cv.put(colValue, "-1");
    db.insert(configTable, colName, cv);
}

RESULT

configTable is being created

tablename is not being created

like image 567
Sherif elKhatib Avatar asked Dec 17 '22 11:12

Sherif elKhatib


1 Answers

simply Change Your Databse name in Data base class which you implemented Using SQliteDatabase

same problem i faced , isolved using same trick.

like image 184
sravan Avatar answered Mar 04 '23 10:03

sravan