This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception while storing into database

 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

db.execSQL("INSERT OR IGNORE INTO " + dbTable + " VALUES ( '"+ store1.getName() +"' , '"+ store1.getYear()+"',, '"+ store1.getDomain()+"', '"+ store1.getLevel()+"');");

I tried it using Toast it return string values my table is also created as per specification 4 fields all of them are string.

How to insert strings into database those are instance variables ,I know i can insert strings with 'string' but what if I have a instance variable ?

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chetan,
Maybe I'm missing something, but what is the exception?

Also is dbTable not an instance variable?
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
..what if I have a instance variable ?


I dont know how to store objects in the SQLite database directly. But, alternatively, if you want to expose your objects to other applications you can take a look at android.content.ContentProvider class.

To create a Content Provider, check this tutorial
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic