• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception while storing into database  RSS feed

 
chetan dhumane
Ranch Hand
Posts: 643
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
Sheriff
Posts: 37393
531
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
Boost this thread!