Click here to Skip to main content
13,591,539 members
Rate this:
Please Sign up or sign in to vote.

the program i am creating has two buttons, one to add records and one to view all added records.
the records add succesfully, but records cannot be viewed. i dont understand what ive done wrong:
public String getData() {
    // TODO Auto-generated method stub
                                      KEY_DUEDATE, KEY_NOTES};
    //Read information from columns
    Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null, null, null);
    String result = "";

    int iRow = c.getColumnIndex(KEY_ROWID);
    int iType = c.getColumnIndex(KEY_TYPE);
    int iName = c.getColumnIndex(KEY_MODULENAME);
    int iWeighting = c.getColumnIndex(KEY_ASSWEIGHTING);
    int iIssue = c.getColumnIndex(KEY_ISSUEDATE);
    int iDue= c.getColumnIndex(KEY_DUEDATE);
    int iNotes = c.getColumnIndex(KEY_NOTES);

    //read entries until cursor is at the end of the last entry

    for (c.moveToFirst();!c.isAfterLast(); c.moveToNext()) {
        //set result to information being read
        result = result +c.getString(iRow) + " " + c.getString(iType) + " " +
                c.getString(iName) + " " + c.getString(iWeighting) + " " + c.getString(iIssue) + " "
                + c.getString(iDue) + " " + c.getString(iNotes) + "\n";
    return result;

Posted 18-May-13 12:01pm
Sergey Alexandrovich Kryukov 18-May-13 22:10pm
Are you a developer or not? If you are, there is no "crash". You would be able to observe exception and provide comprehensive exception information: type, message, in what line, its stack, etc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180618.1 | Last Updated 18 May 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100