【问题标题】:Null and Empty String/Character in SQLIte AndroidSQLite Android 中的 Null 和空字符串/字符
【发布时间】:2015-09-15 10:38:50
【问题描述】:

当我执行时: dbObj.execSql("INSERT INTO table_name (col1,col2) VALUES(1,\"\") "); col2 保存为 NULL?还是空字符串?或者什么!!!!!!?

因为在检索时它显示 col2 为 NULL,即使我的 table_name 定义是:

CREATE TABLE table_name( col1 INTEGER, col2 VARCHAR(255) NOT NULL DEFAULT \"\");

【问题讨论】:

标签: android sqlite


【解决方案1】:

没有理由尖叫。你的问题有点愚蠢。您插入一个空字符串。所以显然保存了一个空字符串。

SQLiteDatabase 的方法是“execSQL”。 “execSql”不存在。

也许你读取 col2 的代码是错误的...

【讨论】:

    猜你喜欢
    • 2022-10-22
    • 1970-01-01
    • 2011-11-25
    • 2015-01-21
    • 1970-01-01
    • 1970-01-01
    • 2017-03-31
    • 2013-12-01
    • 2012-09-18
    相关资源
    最近更新 更多