Hi there, I have a function to write scores in an SQL database table. Here is the code:
public void setScores(int scores[]) { int len = (scores.length > 10) ? 10 : scores.length; SQLiteDatabase db = this.getWritableDatabase(); db.beginTransaction(); db.delete("scores", null, null); ContentValues values = new ContentValues(); int score = 0; for (int i=0; i<len; i++) { score = scores[i]; values.put("score", score); db.insert("scores", null, values); } db.setTransactionSuccessful(); db.endTransaction(); db.close(); } I have checked with Eclipse debugger that scores[] array does actually carries the scores when the function is called and even values different from 0 are assigned on values.put("score", score), but when loading the table later they are not there. O_o This is the function call that creates that table: db.execSQL("CREATE TABLE scores (score UNSIGNED INTEGER)"); It is called only when the database does not exists within the onCreate event on an SQLiteOpenHelper derived class, so it should be created when the inserts are performed. I do not get any error from SQLite when doing the transaction, so I am really lost with this. I have other tables and I perform other inserts and transactions on the same database and those works fine. May be there is something wrong with my code that I have not noticed yet. It is my first attempt to use an SQLite database within an Android app. Thanks a lot in advance, -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en