CREATE TABLE PERSON (ID INTEGER PRIMARY KEY AUTOINCREMENT,
FIRSTNAME TEXT,
LASTNAME TEXT)
WRONG :
CREATE TABLE PERSON (ID INT PRIMARY KEY AUTOINCREMENT,
FIRSTNAME TEXT,
LASTNAME TEXT)
CORRECT :
CREATE TABLE PERSON (ID INTEGER PRIMARY KEY,
FIRSTNAME TEXT,
LASTNAME TEXT)
Java Code To Insert (Do Not Set ID field):
ContentValues values = new ContentValues();
values.put("FIRSTNAME", "Java");
values.put("LASTNAME", "Padawan");
Then on your SQLiteDatabase instance do :
sqlDatabase.insert("PERSON" null, values);
2 comments:
thanks :)
thanks :)
Post a Comment