lundi 1 juin 2015

Update column value into sq-lite

data item from listview When click set button for update data but can't not update data.how can do it? please help me

    Intent i = getIntent();
    dhl_Code = i.getStringExtra("dhl_code");
    edtSetConsignName.setText(dhl_Code);

    btn_setName.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            String name=edtSetConsignName.getText().toString();

            final XMLParserItemSet nameEdit=new XMLParserItemSet();
            nameEdit.dhl_ordercode=name;
            updateCosignMent(nameEdit);
            getSherlock();
            finish();
        }});}

call data from sqlite class

public void updateCosignMent(XMLParserItemSet name) {
    DHLDatabase lms_db = new DHLDatabase(getApplicationContext());
    lms_db.UpdateConsignmentName(name);
    lms_db.dbClose();
}

i create method for update method query on database class

public void UpdateConsignmentName(XMLParserItemSet name) {
ContentValues values = new ContentValues();
    values.put("dhl_ordercode", name.getDhl_ordercode());
    this.Dhldb.update("tbl_consignment", values,
            "consignmentID = ?",new String[]          {String.valueOf(name.consignmentID)});

}

Aucun commentaire:

Enregistrer un commentaire