I'm just learning Android. I have working piece of code that uses ContentValues:
My constants:
public static final String TABLE_NAME = "numbers";
public static final String COL_ID = "_id";
public static final String COL_NUMBER = "number";
This way I create table:
db.execSQL( "CREATE TABLE " + TABLE_NAME + "( " + COL_ID +
" integer primary key autoincrement, " + COL_NUMBER +
" integer not null );" );
And this way I add values to the table:
ContentValues values = new ContentValues();
values.put( SQLHelper.COL_NUMBER, 1 );
long id = db.insert( SQLHelper.TABLE_NAME, null, values );
It works, but when I replace inserting with rawQuery it doesn't insert to the table anymore:
db.rawQuery( "INSERT INTO " + SQLHelper.TABLE_NAME + " VALUES( NULL, 1 )", null );
where do I make a mistake?
Thanks.