0

我有这个数据库结构:

protected static final String Buildings =
        "CREATE TABLE " 
                + Building.BUILDING_TAG + " ( " 
                + Building.ID + " LONG PRIMARY KEY, "
                + Building.NOME + " TEXT,"
                + Building.POSIZIONE + " TEXT, " 
                + Building.DESCRIZIONE + " TEXT, "
                + Building.DATA_C + " LONG, "
                + Building.DATA_U + " LONG, "
                + Building.LINK + " TEXT, "
                + Building.NUMERO_DI_PIANI + " INTEGER NOT NULL, "
                + Building.VERSIONE + " INTEGER, "
                + Building.FOTO + " TEXT, "
                + Building.GEOMETRIA + " TEXT "
                +");";

我正在尝试插入这些数据:

id=6 
descrizione=nel mezzo del cammin di nostra vita 
data_creazione=1353904373000 
geometria=[[46074778,13234062],[46074778,13235521],[46073945,13235521],[46073885,13233976],[46074778,13234062],] 
versione=1 
link=http://www.caso.com/ 
nome=erferf 
foto= 
posizione=[46074332,13234748] 
data_update=1355731095000

每次我从模拟器中删除数据库时,在代码中,我都会尝试删除具有相同 ID 的最终建筑物。

这是错误:

E/Database(16622): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
E/Database(16622):  at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
E/Database(16622):  at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
E/Database(16622):  at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1582)
E/Database(16622):  at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1426)

你能帮助我吗?

4

1 回答 1

0

当错误在右边时,我正在向左看。

我也忘了保存字段numero_di_piani

这么笨!

于 2012-12-19T15:22:33.577 回答