Putting data into ContentValues seems to be going haywire...

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Putting data into ContentValues seems to be going haywire...

Postby Skeniver » Sat Aug 22, 2009 2:28 pm

Hi there

I am trying to put some data into a ContentValue, so that I can save it. But the data isn't saving...

I have a few objects that all put data into ContentValues the same way, so I can't work out why this one isn't.

When i debug and step through the code that is putting the values into the ContentValue, it seems to be writing data over other data...? It will put a name at position[2], then put another value over that? So because my table requires certain values (won't allow not null), I believe it is not saving it...

Is there some sort of convention I am missing that is putting these in in the wrong order? Or does anyone have any ideas? I can post some of the code if it would help...

Thanks in advance
Neil
User avatar
Skeniver
Senior Developer
Senior Developer
 
Posts: 106
Joined: Tue Feb 03, 2009 3:51 pm
Location: Canterbury, UK

Top

Postby Skeniver » Sat Aug 22, 2009 5:13 pm

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. ContentValues newValues = new ContentValues();
  3.  
  4. newValues.put(KEY_ACCOUNTID, accountID);
  5.  
  6. newValues.put(KEY_CATEGORYID, categoryID);
  7.  
  8. newValues.put(KEY_CATEGORY, category);
  9.  
  10. newValuest.put(KEY_DATE_RESET, dateReset.toString());
  11.  
  12. newValues.put(KEY_AMOUNT, amount);
  13.  
  14. newValues.put(KEY_AMOUNT_REMAINING, amountRemaining);
  15.  
  16.  
Parsed in 0.041 seconds, using GeSHi 1.0.8.4


This is the code to put the values into the ContentValues, right before I use an insert statement to save them to my database.

AccountID, CategoryID, and Category write to the ContentValue ok, bu the Date Reset, write over CategoryID, And the Amount writes over the AccountID...

The order that they are in here, is the order that the columns are created in; the order the they lie in the Object; and I can't for the life of me figure out why they aren't saving properly.

Like I said, I have other Objects that save in the exact same way, and they work fine. Please help me someone!

Thanks,
Neil
User avatar
Skeniver
Senior Developer
Senior Developer
 
Posts: 106
Joined: Tue Feb 03, 2009 3:51 pm
Location: Canterbury, UK

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 9 guests