I have a datbase with the following method:
public void deleteNote(long rowId) {
mDb.delete(DATABASE_TABLE, KEY_REALROWID + "=" + rowId, null);
int x = (int) rowId;
int y = testCount();
while(x<y)
{x++;
Cursor note= fetchNote(x);
ContentValues argsan = new ContentValues();
argsan.put(KEY_REALROWID, x-1);
long z
=Integer.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_ROWID)));
mDb.update(DATABASE_TABLE, argsan, KEY_ROWID + "=" + z,
null);
}
}
The insert method is this:
public void createNote(double value, String isroot, String ispower,
String ismultiply, String isdivisor, String add,
String issubtract, double roototpowerval, String
paranthaseesend, String paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_REALROWID, testCount()+1);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
mDb.insert(DATABASE_TABLE, null, initialValues);
}
The fetch method is this:
public Cursor fetchNote(long rowId) throws SQLException {
Cursor mCursor =
mDb.query(true, DATABASE_TABLE, new String[]
{KEY_ISPS,KEY_ISPE,KEY_VALUE,
KEY_ISROOT,KEY_REALROWID,KEY_ISPOWER,KEY_POWERORROOTNUMBER,KEY_ISDIVISOR
,KEY_ISMULTIPLIER,KEY_ISADD,KEY_ISSUBTRACT},
KEY_REALROWID + "=" + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
When I run this I get an error:
mDbHelper.createNote(d, "false", "false", "false", "false",
"false", "false", 0, "false", "false");
mDbHelper.createNote(0, "false", "false",
"false","false",
"false", "true", 0, "false", "false");
mDbHelper.createNote(d, "false", "false", "false","false",
"false", "false", 0, "false", "false");
mDbHelper.createNote(d, "false", "false", "false","false",
"false", "false", 0, "false", "false");
mDbHelper.deleteNote(3);
Cursor c = mDbHelper.fetchNote(3);
Help would be greatly appreciated.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en