2 weixin 35894203 weixin_35894203 于 2016.09.26 21:21 提问

来个大神拯救我,出了啥问题啊

09-26 21:08:08.626 23725-23725/com.example.databasetest E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.databasetest, PID: 23725
android.database.sqlite.SQLiteException: near "the": syntax error (code 1): , while compiling: create the BOOK(id integer primary key autoincrement,author text,price real,pages integer,name text)
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:898)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:509)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1704)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1635)
at com.example.databasetest.MyDatabaseHelper.onCreate(MyDatabaseHelper.java:27)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpe

6个回答

niaonao
niaonao   Rxr 2016.09.26 21:46

create the BOOK(
id integer primary key autoincrement,
author text,
price real,
pages integer,
name text)

提示语句错误吧

sql 语句有 text 类型吗有 real 类型吗
不是 String
oSanYeCao1234567
oSanYeCao1234567   Ds   Rxr 2016.09.26 21:56

create table BOOK 不是 create the BOOK

lxk_1993
lxk_1993   Rxr 2016.09.27 14:05

create the BOOK(id integer primary key autoincrement,author text,price real,pages integer,name text) 这句

u014728795
u014728795   2016.09.29 19:33

create table?

baidu_28558165
baidu_28558165   2016.10.11 11:13

哈哈哈哈,数据库执行语句写错了

a791123503
a791123503   2016.10.12 23:54

语句写错了,CREATE TABLE BOOK

Csdn user default icon
上传中...
上传图片
插入图片