gpt4 book ai didi

sqlite - SQLite中的自动增量

转载 作者:行者123 更新时间:2023-12-03 15:20:37 30 4
gpt4 key购买 nike

我用它来使一列自动变暗,

"create table info (ID INTEGER PRIMARY KEY AUTOINCREMENT, age int)"
插入表中,我有这个!

public static void databaseInsertInfoTable(int ID,int age){...}


当我想调用databaseInsertInfoTable时,它不接受null作为ID。

databaseInsertInfoTable(null,12);// this has error!


我应该为ID插入什么值?

最佳答案

根据SQLite FAQ的说法,在插入中使用“ null”应该很好。

但是,如果使用Java,则无法传递null,其中参数类型是类似int的基元。您必须使用Java的“ wrapper classes”之一才能传递空值,因此请尝试在其中放置Integer而不是int

关于sqlite - SQLite中的自动增量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6989162/

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