Im having the following code to access records from the SQLite database based upon ID,
public ComplianceApproval getCompApproval(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_COMP_APPROVE, new String[]{KEY_ID,
KEY_ASSIGNEE_ID, KEY_ASSIGNEE_NAME, KEY_DUE_DATE, KEY_COMPLIANCE_FREQUENCY,
KEY_DOC, KEY_DESC, KEY_UPLOAD_DATE, KEY_COMPNAME, KEY_VALIDITY_DATE,
KEY_DOMAIN_NAME, KEY_NEXT_DUE_DATE, KEY_STATUTORY_MONTH,
KEY_STATUTORY_DATE, KEY_TRIGGER_BEFORE, KEY_REPEAT_BY,
KEY_DELAYED_BY, KEY_ACTION, KEY_COMPLETEION_DATE, KEY_UNIT_NAME, KEY_FILENAME,
KEY_REMARKS, KEY_COMPLIANCE_HISTORY_ID, KEY_CONCURRED_BY, KEY_STARTDATE}, KEY_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
ComplianceApproval complianceApproval = new ComplianceApproval(cursor.getInt(0), cursor.getInt(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5), cursor.getString(6), cursor.getString(7), cursor.getString(8), cursor.getString(9), cursor.getString(10), cursor.getString(11), cursor.getString(12), cursor.getString(13), cursor.getString(14), cursor.getString(15), cursor.getString(16), cursor.getString(17), cursor.getString(18), cursor.getString(19), cursor.getString(20), cursor.getInt(21), cursor.getString(22), cursor.getString(23), cursor.getString(24));
// return contact
return complianceApproval;
}
inorder to invoke the above method, im using the following code.
ComplianceApproval compApproval = Db.getCompApproval(1);
Now that if I have to access "remarks", i will be accessing it like complianceApproval.getRemarks that should print the corresponding remarks but the problem is that, it is printing compliance_history_id instead of remarks.
How can I sort this out?
Aucun commentaire:
Enregistrer un commentaire