I have been working on an android app for a while now, and have gotten it to the point where I have handed it in and received my grade already. However, I have been playing around with it in my spare time, and would like to upgrade it a little. To summarize what my app does so far:
- Allows user to create a list of classes
- Allows user to create a list of assignments for those classes
- Allows user to edit classes/assignments
I have recently been getting a force close after editing my helper class for the assignments. I have been able to narrow down where the issue is originating.
return (getReadableDatabase().rawQuery("SELECT _id, assname, urge, name, assday, assmonth FROM assignments ORDER BY "+ orderBy, null));
it seems like that particular statement is giving me an error in both instances that it appears.
return (getReadableDatabase().rawQuery("SELECT _id, assname, urge, name, assday, assmonth FROM assignments WHERE _ID=?", args));
When I remove assday and assmonth from both of those statements and stop the program from adding them to the content values, the error goes away.
All I want to do is add a column for the due date and month so I can display it on the assignments list. I know how to do this, however the error is stopping me. Thank you in advance.
I am sorry for the vague question and for the slow response times. I was careless in attempting to implement this feature and managed to overlook adding the columns to the table in the “CREATE TABLE” statement. I apologize for everybody’s wasted time.
Before:
db.execSQL("CREATE TABLE assignments (_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, address TEXT, type TEXT);");After:
db.execSQL("CREATE TABLE restaurants (_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, address TEXT, type TEXT, assday TEXT, assmonth TEXT);");Since I have two helper classes (which I have been informed is a bad idea, and I now see why) I forgot to edit the one whose onCreate() is called. I once again am sorry for the negligence on my part.