本文介绍了android.database.sqlite.SQLiteException:没有这样的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题(LogCat中)

code

 公共无效的onCreate(SQLiteDatabase DB){
    Log.v(SQLAdapter,的onCreate(SQLiteDatabase分贝));
    db.execSQL(CREATE TABLE+表名
            +(
            + 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 =新ContentValues​​();
    cv.put(COLNAME,更新);
    cv.put(COLVALUE, -  1);
    db.insert(configTable,COLNAME,CV);
}
 

结果

解决方案

简单的改变,你实现了使用SQliteDatabase在数据基础类你DATABSE名称

我面临同样的问题,isolved使用同样的伎俩。

ISSUE (LogCat)

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

解决方案

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

same problem i faced , isolved using same trick.

这篇关于android.database.sqlite.SQLiteException:没有这样的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 06:40