dimanche 29 mars 2015

Get this error android.database.sqlite.SQLiteException: near “ ”: syntax error

Hey guys I hope you can help me out here


I get this error but can't find how to solve the problem



java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sergej.myapplication4/com.sergej.slidnerd_kopie.training.MeinePlaene_main}: android.database.sqlite.SQLiteException: near "SETSworkout": syntax error (code 1): , while compiling: CREATE SETSworkout(name TEXT)


That is the my Create Table



public class WorkoutDataHelper extends SQLiteOpenHelper {

public static final int DB_VERSION = 2;
public static final String DB_NAME = "dmworkouts.db";
public static final String WORKOUT_TABLE_NAME = "workouts";

public static final String SETS_TABLE_NAME = "workouts";
public static final String SESSIONS_TABLE_NAME = "sessions";
public static final String CREATE_WORKOUT_TABLE = "CREATE TABLE " + WORKOUT_TABLE_NAME +
" ( name TEXT )";
public static final String CREATE_SETS_TABLE ="CREATE SETS"+SETS_TABLE_NAME+"(name TEXT)";
public static final String CREATE_SESSIONS_TABLE = "CREATE TABLE " + SESSIONS_TABLE_NAME +
" ( time INTEGER, workoutid INTEGER, type INTEGER)";


public WorkoutDataHelper(Context context) {
super(context,DB_NAME, null, DB_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_WORKOUT_TABLE);
db.execSQL(CREATE_SETS_TABLE);

db.execSQL(CREATE_SESSIONS_TABLE);
}


}


I think the problem is somewhere at CREATE_WORKOUT_TABLE but I tried to solve it but I did not make it.


Aucun commentaire:

Enregistrer un commentaire