作者:hhha老窝_349 | 来源:互联网 | 2023-10-12 19:27
When I'm trying to run the following :
当我试图运行以下内容时:
ContentValues cv = new ContentValues();
cv.put(table_LocalSettings_Unit, input);
mDb.insert(table_LocalSettings, "", cv);
I got the following error:
我有以下错误:
Error inserting unit = 0;
SqliteConstraintException: error code 19 constraint failed.
插入单元错误= 0;SqliteConstraintException:错误代码19约束失败。
What should be the problem ? The table sql Code is:
问题应该是什么?表sql代码为:
"create table if not exists " + table_LocalSettings + "( " + table_LocalSettings_ID
+ " INTEGER PRIMARY KEY NOT NULL , " + table_LocalSettings_MapType
+ " INTEGER NOT NULL , " + table_LocalSettings_Visib + " BIT NOT NULL , "
+ table_LocalSettings_Unit + " INTEGER DEFAULT 0 NOT NULL , "
+ table_LocalSettings_SpeedUnit + " INTEGER NOT NULL , "
+ table_LocalSettings_Alert + " BIT NOT NULL ," + table_LocalSettings_UserID
+ " INTEGER DEFAULT -1 , " + table_LocalSettings_Username + " VARCHAR , "
+ table_LocalSettings_PowerSave + " VARCHAR , " + table_LocalSettings_PremiumUser
+ " INTEGER NOT NULL DEFAULT 0);";
4 个解决方案