-1
public void addup(UserProfile profile)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("countrycode", profile.getCCode());
values.put("deviceid",profile.getDID());
values.put("devicename", profile.getDName());
values.put("homeLoc",profile.getLat()+","+profile.getLong());
values.put("mobile", profile.getMobileNum().toString());
values.put("name",profile.getUName());
values.put("password", profile.getPWD());
values.put("uid", profile.getUID());
}
我试过这个,但是每次使用时都放一个索引总是被新值替换。我曾尝试使用ContenValues(8)将所有内容都设置在正确的位置,但同样的情况再次发生。请帮忙在Android中使用ContentValues添加值时,下一个put方法会覆盖已添加的值
你认为'addup'方法能做什么? – iRuth 2015-02-07 11:20:20
它被用来将行添加到sqlite数据库。在使用put时,值会被添加到某个值中,并且一些值将被添加到同一个索引中,以替换旧的值,因此不会将旧值添加到数据库中的列中。请帮忙。 – 2015-02-09 02:39:42