• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to Insert data in SQLite

 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have the following code ,but when the method insertLabel() is called from MainActivity ,Logcat throws an exception saying tabel labels has no column named name , eventhough i am creating the column ,please let me know if anything is missing :
 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not able to figure out what is the problem here , I am creating a columns called 'name' right? I dont know why it is not able to insert data.
 
Swastik Dey
Rancher
Posts: 1637
6
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use an exception handler for the insertion code, and see if you are getting any exception.
 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Swastik ,

Its throwing android.database.sqlite.SQLiteException : table labels has no column named nmes(code 1).Still unable to figure out why!!
 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
udaya krishna wrote:Hi Swastik , actual error

Its throwing android.database.sqlite.SQLiteException : table labels has no column named names(code 1).Still unable to figure out why!!


And in getAllLables()
is always false when i run in debug mode , so
is never executed..

 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
udaya krishna wrote:Hi Swastik ,

Its throwing android.database.sqlite.SQLiteException : table labels has no column named nmes(code 1).Still unable to figure out why!!

Is that the exact error message, copy and pasted? Is the code you posted the exact code? Why is the column being used in the error message as nmes and not name like the constant in your code? Note that there are two differences: a missing a and an added s.

If both the code and the error message are correct, then un-install the app and try re-installing it. It could be that the application did not properly close at one point and was left in memory. You make changes but those changes may not be properly reflected in the app that runs. If you are using Eclipse to compile the code, it won't hurt to do a clean build as well - I have seen the build not finish completely but not provide errors either, allowing a bad mix of code to reach the phone which caused 'impossible' errors.
 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,

Sorry , the exception was a typo as i did not know how to copy and paste from Logcat, but the column names are indeed correct , and yes i have tried building it several times.still no luck
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic