gpt4 book ai didi

android - 无法在 SQLite 中插入,错误代码 :19

转载 作者:IT王子 更新时间:2023-10-29 06:21:10 25 4
gpt4 key购买 nike

当我尝试运行以下命令时:

  ContentValues cv = new ContentValues();
cv.put(table_LocalSettings_Unit, input);
mDb.insert(table_LocalSettings, "", cv);

我收到以下错误:

Error inserting unit = 0;
SqliteConstraintException: error code 19 constraint failed.

应该是什么问题?表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);";

最佳答案

constraint failed

听起来你的主键已经存在于表中

关于android - 无法在 SQLite 中插入,错误代码 :19,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3415589/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com