これは私がActivity
すべての仕事をしている私のメインです。データベースの作成中にエラーが発生しSQLite
ます。
private final String DB_NAME = "pocketCloudlets";
private final String TABLE_NAME_1 = "Members";
long count = 0;
static final String userTable="user";
static final String userName = "User";
static final String userID = "_id";
static final String age ="age";
static final String gender = "gender";
static final String password = "password";
static final String email = "email";
// Creating Table for User Record
protected static final String table1=(" CREATE TABLE IF NOT EXISTS "
+ userTable + " ("
+ userID + " INTEGER PRIMARY KEY NOT NULL, "
+ userName + " VARCHAR ,"
+ age + " VARCHAR ,"
+ gender + " VARCHAR )");
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
ArrayList<String> results = new ArrayList<String>();
SQLiteDatabase sampleDB = null;
try {
sampleDB = this.openOrCreateDatabase(DB_NAME, MODE_PRIVATE, null);
sampleDB.execSQL(table1);
sampleDB.execSQL("INSERT INTO " +
userTable +
" Values ('13','dawdaa','4','female');");
Cursor c = sampleDB.rawQuery("SELECT _id,userName, age, gender FROM " +
userTable + " ", null);
} catch (Throwable t) {
// completed by the editor of this question
// the 'catch' part of the try-catch structure was NOT present
}