public class MyOpenHelper extends SQLiteOpenHelper {
public class MyOpenHelper extends SQLiteOpenHelper {
public MyOpenHelper(Context context) {
super(context, "NameCommentDB", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table person(" +
"name text not null," +
"comment text," +
"time text," +
");");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
}
*エラー時コード
public class MyOpenHelper extends SQLiteOpenHelper {
public class MyOpenHelper extends SQLiteOpenHelper {
public MyOpenHelper(Context context) {
super(context, "NameCommentDB", null, 2);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table person(" +
"name text not null," +
"comment text," +
"time text," +
");");
db.execSQL("create table oasis(" +
"name text not null," +
"comment text," +
"time text," +
");");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.building_event);
MyOpenHelper helper = new MyOpenHelper(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.building_event);
MyOpenHelper helper = new MyOpenHelper(this);
*** final SQLiteDatabase db = helper.getReadableDatabase(); ←
エラーメッセージ*
E/SQLiteLog: (1) near ")": syntax error
E/AndroidRuntime: FATAL EXCEPTION: main
E/SQLiteLog: (1) near ")": syntax error
E/AndroidRuntime: FATAL EXCEPTION: main