在sqlite数据库上创建表错误 - android [英] Create table error on sqlite database - android

查看:209
本文介绍了在sqlite数据库上创建表错误 - android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行我的应用程序后,应立即创建一个sqlite数据库。我在create table语句附近收到错误说TABLEtbl_Repair_Status:语法错误(代码1)...



我的实际语句没有任何语法错误,也没有日志猫正在显示缺少的空间。



知道问题可能是什么?

解决方案

< blockquote>尝试在主键上添加 not null

  private   static  final  String  createRepairStatus =   CREATE TABLE + TABLE_REPAIR_STATUS +  (_ id INTEGER PRIMARY KEY NOT NULL,status_name TEXT);; 


解决了这个问题。



尝试关闭并重新打开Eclipse。

 ...   CREATE TABLE + TABLE_REPAIR_STATUS ... 

重新启动后没有空间,我确信之前有空。



我希望这有助于其他人太


An sqlite database should be created as soon as I run my application. I am getting an error near the create table statement saying TABLEtbl_Repair_Status: syntax error(code 1)...

My actual statement does not have any syntax errors, nor does it have that missing space the log cat is displaying.

Any idea what the problem might be ?

解决方案

Try adding not null on your primary key:

private static final String createRepairStatus = "CREATE TABLE " + TABLE_REPAIR_STATUS + "(_id INTEGER PRIMARY KEY NOT NULL, status_name TEXT);" ;


Solved this question.

Tried closing down and re-opening Eclipse.

..."CREATE TABLE" + TABLE_REPAIR_STATUS...

had no space after restarting, which I am positively sure was there before.

I hope this helps someone else too.


这篇关于在sqlite数据库上创建表错误 - android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆