Click here to Skip to main content
11,439,025 members (75,614 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 13: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)



Advertise | Privacy | Mobile
Web03 | 2.8.150506.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