
Untitled
By: a guest on
May 4th, 2012 | syntax:
None | size: 0.81 KB | hits: 22 | expires: Never
Android - SQLite Cursor getColumnIndex() is case sensitive?
Column Name in DB was: Rules
cursor.getColumnIndex("Rules") //workes fine
cursor.getColumnIndex("rules") //throws error, see the error detail
// write table name
public static final String TABLE_MESSAGE = "messages";
// and column name accordingly
public static final String COLUMN_ID = "_id";
public static final String COLUMN_MESSAGE = "message";
// TABLE creation sql statement
private static final String TABLE_CREATE = "create table "
+ TABLE_MESSAGE + "( " + COLUMN_ID
+ " integer primary key autoincrement, " + COLUMN_MESSAGE
+ " text not null);";
database.query(TABLE_MESSAGE, new String[]{COLUMN_ID,COLUMN_MESSAGE}, null, null, null, null, null);
int index = cursor.getColumnIndex(COLUMN_MESSAGE);