根据报错信息,你的表dict有2列,但是你的插入语句提供了3个值。根据你提供的代码,可能是因为你在创建表时没有指定列名的类型。

你可以尝试修改你的创建表的语句,为每一列指定相应的类型,例如:

public static final String CREATE_TABLE_SQL = "create table dict(_id integer primary " +
        "key autoincrement, word text, detail text)";

在这个例子中,我假设worddetail都是文本类型,你可以根据实际的需求修改相应的类型。

然后,在执行插入语句时,确保提供的值和列的顺序一致:

db.execSQL("insert into dict values(null, ?, ?)", new String[]{word, detail});

这样应该能够解决你的问题。

Process comapplicationdatashared PID 28235 androiddatabasesqliteSQLiteException table dict has 2 columns but 3 values were supplied code 1 SQLITE_ERROR while compiling insert into dict valuesnull

原文地址: https://www.cveoy.top/t/topic/jakp 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录