Home > database >  How to assign values to the TextView after sum in android sqlite
How to assign values to the TextView after sum in android sqlite

Time:09-21

 
Intent intent1=getIntent ();
String key1=intent1. GetStringExtra (" one ");
String sum_turnover="select sum (turnover) from svalue where the date like" + "' % %" + key1 + "'";
String sum_tc="select sum (tc) from svalue where the date like" + "' % %" + key1 + "'";
Cursor cursor1=db. RawQuery (sum_turnover, null);
While ((cursor1 moveToNext ())) {
String stu=cursor1. Get String (4);
Sturnover. SetText (stu);
Cursor1. Close ();

This is the code, but after the operation complains, how do I query sqlite sum after the assignment

CodePudding user response:


String stu=cursor1. Get String (cursor1 getColumnIndex (" sum (turnover) "));
You can try this change
  • Related