i have error when i try to save in database it immediately crashes with the error SQLiteException: no such column. I'm stumped on what to do as SQLite is still very much a mystery to me.
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)
1 Answer 1
Actually, your logcat says no such table. I believe this is because your onCreate() method is empty, so the table is never getting created. Update your code in DbManager as follows:
@Override
public void onCreate(SQLiteDatabase db)
{
db.execSQL(CREATE_POINTS);
}
Also, you've got two different table names in your code. In DbManager:
private static final String TABLE_POINT = "point";
In PointBDD:
private static final String TABLE_POINT = "table_point";
answered Mar 29, 2014 at 0:20
Mike M.
39.3k8 gold badges104 silver badges98 bronze badges
Sign up to request clarification or add additional context in comments.
8 Comments
Mike M.
Ok, which error?
no such table or no such column?AhmeX
no such table: table_point: , while compiling: INSERT INTO table_point(ID,Y,X,description,nom) VALUES (?,?,?,?,?)
Mike M.
Check my edit. After you fix the table names, uninstall and reinstall again.
AhmeX
i fix it and change the name of TABLE_POINT ="ponit" and i uninstall and reinstall but the application still crashing
Mike M.
Has your logcat changed? If so, please edit your question to show the new info. If not, lemme know; I'll have another look.
|
lang-sql