SQLite 插入列失败

小弟Android初学者,做一个练习的时候遇到小问题,求解答,谢谢!

问题:TIME = time这个列的添加时,为什么失败了?

代码如下:
图片描述

报错如下:提示“table notes has no column named time”

11-12 11:43:16.647 24230-24230/com.xuchangju.hellonotes2 E/SQLiteLog: (1) table notes has no column named time
11-12 11:43:16.667 24230-24230/com.xuchangju.hellonotes2 E/SQLiteDatabase: Error inserting content=Hello time=2015年11月12日 11:43:16
11-12 11:43:16.667 24230-24230/com.xuchangju.hellonotes2 E/SQLiteDatabase: android.database.sqlite.SQLiteException: table notes has no column named time (code 1): , while compiling: INSERT INTO notes(content,time) VALUES (?,?)

万分感谢!

阅读 6.2k
2 个回答

你是不是没有time这个字段?

你是不是之前测试时,create了notes表,没有卸装。之后改了代码加入time字段,又create一次表?
create了notes表之后,就不会再调用onCreate()了
先卸装久版本,再安装

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题