SQLiteException while updating the DataBase

Quickly share your Android Code Snippets here...

SQLiteException while updating the DataBase

Postby kamalpreet.singh » Sat Mar 13, 2010 8:10 pm

Hello frnds,

I am trying to update one of the SQLitetable and I am getting following exception:
03-13 12:57:54.886: ERROR/Database(671): Error updating Msg=good using UPDATE account_table SET Msg=? WHERE name=?
03-13 12:58:04.237: WARN/dalvikvm(671): threadid=15: thread exiting with uncaught exception (group=0x4001b188)
03-13 12:58:04.237: ERROR/AndroidRuntime(671): Uncaught handler: thread SmartTalkyEngine exiting due to uncaught exception
03-13 12:58:04.446: ERROR/AndroidRuntime(671): android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x11da60
03-13 12:58:04.446: ERROR/AndroidRuntime(671): at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method)
03-13 12:58:04.446: ERROR/AndroidRuntime(671): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:178)


below are my functions:
[syntax="java"]
public long setMsg(String message, String userName) {
ContentValues values = new ContentValues();
values.put(Account.MSG, message);
String args[] = new String[] {message, userName};
return mDbHelper.updateInternal(Account.CONTENT_URI, values, mDb, Account.NAME + "=?" , args);
}


long updateInternal(Uri uri, ContentValues values, SQLiteDatabase db, String where, String[] args) {
String table = null;
if(uri.compareTo(Account.CONTENT_URI) == 0) {
table = DATA_BASE_TABLE_ACCOUNT;
}
return db.update(table, values, where, args);
}

Account table looks like this:
public static class Account {
public static final String ID="id";
public static final String NAME = "name";
public static final String MSG = "Msg";
}

any help/pointers?
regards-
Kamalpreet
kamalpreet.singh
Junior Developer
Junior Developer
 
Posts: 11
Joined: Sun Jan 24, 2010 6:14 pm

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 3 guests