I want to insert the values inside 2 strings into a table using dbadapter.
I am able to insert one string named as 'inputparticulars' to a column named
as 'TX_PARTICULARS'. How to insert another the value from another string
'inputamount' to another column named as 'TX_AMOUNT' in the same row.
public void onTxClick(View v)
{String inputparticulars=particulars.getText().toString();
String inputamount=amount.getText().toString();
ContentValues contentvalues=new ContentValues();
vivzHelper.insertTxData(inputparticulars);
}
public long insertTxData(String inputparticulars) {
SQLiteDatabase db = helper.getWritableDatabase();
ContentValues contentvalues = new ContentValues();
contentvalues.put(VivzHelper.TX_PARTICULARS,inputparticulars);
//contentvalues.put(VivzHelper.TX_AMOUNT, inputamount);
contentvalues.put(VivzHelper.TX_DATE, Calendar.DATE);
long id = db.insert(VivzHelper.TX_TABLE, null, contentvalues );
return id;
}
Aucun commentaire:
Enregistrer un commentaire