小编she*_*naz的帖子

在android中创建表时出现语法错误

private static final String DATABASE_TABLE_TRANS = "Transaction";   
private static final String DATABASE_CREATE_TRANS = 
       "create table " + DATABASE_TABLE_TRANS + "(_id integer primary key autoincrement, "
       + "Amount text not null, " + "Name_of_bank text unique not null, " 
       + "Trans_Time text not null);";

 public void onCreate(SQLiteDatabase db) 
        {
            System.out.println("oncreate of dbbbbbbbbbbbbbbbbb");
            db.execSQL(DATABASE_CREATE_TRANS);
        }
Run Code Online (Sandbox Code Playgroud)

在运行时我收到错误:

 08-05 14:40:15.187: ERROR/AndroidRuntime(5362):
 android.database.sqlite.SQLiteException: near "Transaction": syntax
 error: create table Transaction(_id integer primary key autoincrement,
 Amount text not null, Name_of_bank text unique not null, Trans_Time
 text …
Run Code Online (Sandbox Code Playgroud)

database sqlite android

2
推荐指数
1
解决办法
1338
查看次数

标签 统计

android ×1

database ×1

sqlite ×1