Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android.database.sqlite.SQLiteException:near";“订单”:语法错误(代码1):_Android_Sqlite_Exception - Fatal编程技术网

android.database.sqlite.SQLiteException:near";“订单”:语法错误(代码1):

android.database.sqlite.SQLiteException:near";“订单”:语法错误(代码1):,android,sqlite,exception,Android,Sqlite,Exception,我的代码在sqlite中总是出现语法异常。 它总是在onCreate of DatabaseHelper中突出显示。 错误可能是在创建表“Order”时发生的 我正在使用Android Studio,并通过在listview中通过适配器创建一个类a来填充它,从而开发订购系统 这是我的密码: package com.example.lenovot420.yumburgers; import android.content.Context; import android.database.sqli

我的代码在sqlite中总是出现语法异常。 它总是在onCreate of DatabaseHelper中突出显示。 错误可能是在创建表“Order”时发生的

我正在使用Android Studio,并通过在listview中通过适配器创建一个类a来填充它,从而开发订购系统

这是我的密码:

package com.example.lenovot420.yumburgers;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
* Created by lenovot420 on 9/24/2017.
*/

public class DatabaseHelper extends SQLiteOpenHelper {

//version number to upgrade database version
//each time if you Add, Edit table, you need to change the
//version number.
private static final int DATABASE_VERSION = 1;

// Database Name
private static final String DATABASE_NAME = "JollibeeOrder.db";

public DatabaseHelper(Context context ) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
    //All necessary tables you like to create will create here

    String CREATE_TABLE_ORDER = "CREATE TABLE " + Order.TABLE + " ("
            + Order.KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
            + Order.KEY_ORDER_NAME + " TEXT, "
            + Order.KEY_ORDER_EXTRA + " TEXT, "
            + Order.KEY_ORDER_PRICE + " TEXT, "
            + Order.KEY_ORDER_QUANTITY + " TEXT, "
            + Order.KEY_ORDER_TOTAL + " TEXT, "
            + Order.KEY_ORDER_PHOTO + " INTEGER )";

    db.execSQL(CREATE_TABLE_ORDER);

}


@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    // Drop older table if existed, all data will be gone!!!
    db.execSQL("DROP TABLE IF EXISTS " + Order.TABLE);

    // Create tables again
    onCreate(db);

}
}
订单
是一个标识符,不能用作标识符。您需要
“引用它”
,或者更好的是,将它重命名为非关键字