I wanna create a simple db but i got syntax error can anyone help me to fix this.Here is my db helper:
private static final int DATABASE_VERSION=1;
private static final String DATABASE_NAME="userDatabase";
private static final String TABLE_NAME="person";
private static final String USER_NAME="user";
public MyDatabaseHelper(Context context) {
// TODO Auto-generated constructor stub
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase arg0) {
// TODO Auto-generated method stub
String CREATE_USER_TABLE="create table"+TABLE_NAME+"("
+USER_NAME+"text primary key);";
arg0.execSQL(CREATE_USER_TABLE);
}
I got this error: 02-12 13:41:26.527: E/AndroidRuntime(6773): Caused by: android.database.sqlite.SQLiteException: near "tableperson": syntax error (code 1): , while compiling: create tableperson(usertext primary key);
Aucun commentaire:
Enregistrer un commentaire