Java 当点击AccButton(AcceptButton)时,SQLite停止工作

Java 当点击AccButton(AcceptButton)时,SQLite停止工作,java,android,sqlite,android-sqlite,Java,Android,Sqlite,Android Sqlite,我有两个活动,一个是数据库助手,另一个是主活动。没有sytax错误,但每当我按下Accept按钮(accButton),我的应用程序就会停止工作。 请帮帮我,谢谢 DBhelper类中的代码 @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table" + TABLE_NAME + "create table LMSLiteDB(ID text primary key n

我有两个活动,一个是数据库助手,另一个是主活动。没有sytax错误,但每当我按下Accept按钮(accButton),我的应用程序就会停止工作。 请帮帮我,谢谢

DBhelper类中的代码

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table" + TABLE_NAME + "create table LMSLiteDB(ID text primary key not null," +
                "Password text not null, Name text not null, VU-Email text not null, City text not null," +
                "Country text not null, Selected_Course text not null);");

    }

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


        db.execSQL("DROP TABLE IF EXISTS" + TABLE_NAME);
        onCreate(db);
    }

    public boolean insertValues(String id, String autoPass, String name, String mail, String city, String contry , String selectedCourse) {
        SQLiteDatabase db = this.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(COLUMN_ID, id);
        values.put(COLUMN_PASSWORD, autoPass);
        values.put(COLUMN_Name, name);
        values.put(COLUMN_VUEmail, mail);
        values.put(COLUMN_CITY, city);
        values.put(COLUMN_COUNTRY, contry);
        values.put(COLUMN_SELECTEDCOURSE, selectedCourse);

        long result = db.insert(TABLE_NAME, null, values);
        if (result == -1)
            return false;
        else
            return true;
    }
主活动中的代码

public void onAccClick(View view) {

        TextView tfName = (TextView) findViewById(R.id.fName);
        TextView tEmail = (TextView) findViewById(R.id.vuEmail);
        TextView tId = (TextView) findViewById(R.id.id);
        TextView tPassword = (TextView) findViewById(R.id.password);
        TextView tCity = (TextView) findViewById(R.id.city);
        TextView tContry = (TextView) findViewById(R.id.contry);
        TextView tItem = (TextView) findViewById(R.id.item);


        boolean isInserted = db.insertValues(tId.getText().toString(), tPassword.getText().toString(), tfName.getText().toString(),
                tEmail.getText().toString(), tCity.getText().toString(), tContry.getText().toString(),
                tItem.getText().toString());
        if (isInserted = true) {
            Toast.makeText(ACCEPT.this, "Data Inserted", Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(ACCEPT.this, "Data not Inserted", Toast.LENGTH_LONG).show();
        }
    }
}

我想您的表格创建不正确。更新CREATETABLE语句

使用:

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table " + TABLE_NAME + " (ID text primary key not null, " +
                "Password text not null, Name text not null, VU-Email text not null, City text not null," +
                " Country text not null, Selected_Course text not null);");

    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table" + TABLE_NAME + "create table LMSLiteDB(ID text primary key not null," +
                "Password text not null, Name text not null, VU-Email text not null, City text not null," +
                "Country text not null, Selected_Course text not null);");

    }
而不是:

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table " + TABLE_NAME + " (ID text primary key not null, " +
                "Password text not null, Name text not null, VU-Email text not null, City text not null," +
                " Country text not null, Selected_Course text not null);");

    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table" + TABLE_NAME + "create table LMSLiteDB(ID text primary key not null," +
                "Password text not null, Name text not null, VU-Email text not null, City text not null," +
                "Country text not null, Selected_Course text not null);");

    }

我的应用程序停止工作。
显示日志和代码的相关部分“停止工作”从未作为问题描述开始工作。请阅读,如何构建,尤其是