2014-03-29 98 views
0

我有錯誤,當我嘗試保存在數據庫中它立即崩潰與錯誤SQLiteException:沒有這樣的列。我很難做什麼,因爲SQLite對我來說依然非常神祕。Android的SQLite數據庫錯誤SQLiteException

的logcat:

03-29 01:04:29.823: E/SQLiteDatabase(23044): Error inserting ID=0 Y=15.085753686726093 X=26.93791172584063 description=Programmez pour Android nom=marker 
03-29 01:04:29.823: E/SQLiteDatabase(23044): android.database.sqlite.SQLiteException: no such table: table_point: , while compiling: INSERT INTO table_point(ID,Y,X,description,nom) VALUES (?,?,?,?,?) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:177) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:395) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteStatement.acquireAndLock(SQLiteStatement.java:263) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:115) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1718) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1591) 
03-29 01:04:29.823: E/SQLiteDatabase(23044): at tn.pfe.ybn.sigl.database.PointBDD.insertPoint(PointBDD.java:61) 

回答

2

其實,你的logcat說no such table。我相信這是因爲你的onCreate()方法是空的,所以表不會被創建。更新你的代碼DbManager如下:

@Override 
public void onCreate(SQLiteDatabase db) 
{ 
    db.execSQL(CREATE_POINTS); 
} 

而且,你有你的代碼的兩個不同的表名。在DbManager

private static final String TABLE_POINT = "point"; 

PointBDD

private static final String TABLE_POINT = "table_point"; 
+0

我添加它,還是同樣的錯誤 – AhmeX

+0

嘗試卸載應用程序,然後重新安裝。 –

+0

我嘗試過,但不工作相同的錯誤 – AhmeX