Click here to Skip to main content
11,703,631 members (70,608 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android SQLlite
hi,

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
    String[] columns = new String[]{KEY_ROWID, KEY_TYPE, KEY_MODULENAME, KEY_ASSWEIGHTING, KEY_ISSUEDATE,
                                      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
Comments
Sergey Alexandrovich Kryukov at 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.
—SA

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

  Print Answers RSS
0 Maciej Los 570
1 OriginalGriff 515
2 Sergey Alexandrovich Kryukov 460
3 Andy Lanng 209
4 CPallini 195
0 OriginalGriff 8,519
1 Sergey Alexandrovich Kryukov 7,667
2 CPallini 4,987
3 Maciej Los 4,686
4 Mika Wendelius 3,566


Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 18 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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