【问题标题】:When i click button ? Inserted value in edittext should be total and Calculate to display in another edittext with the help SELECT QUERY?当我点击按钮?在编辑文本中插入的值应该是总计和计算以显示在另一个编辑文本中,帮助选择查询?
【发布时间】:2014-07-10 07:35:40
【问题描述】:

PaymentPaid(editText) 中插入的所有值都应该是总和并显示到 totalamt(Edittext)。 '

Next.setOnClickListener(new View.OnClickListener() {

    public void onClick(View arg0) {

    try {

                String sql= Select-------?
        String amntpaid=PaymentPaid.getText().toString();       
        String totamnt=totalamt.getText().toString();
                }
                catch (Exception e) {
                e.printStackTrace();
                }
                }
            });`

【问题讨论】:

    标签: android xml android-edittext


    【解决方案1】:

    试试这个......

     int subtotal = 0;
     int total =0;
     Cursor  cursor = dh.rawQuery("SELECT _column_name FROM table_name WHERE _column_name LIKE ? ", new String[] {"%"});
    if(cursor.moveToFirst())   
                do{
    
        subtotal = cursor.getInt(cursor.getColumnIndex("_column_name"));
                    total = total+subtotal;
                }while(cursor.moveToNext());
         total_show_edttxt.setext(total);
    

    【讨论】:

    • 这是行不通的先生!!..实际上我正在使用 h2 数据库..db 文件...我正在使用 jdbc..
    猜你喜欢
    • 1970-01-01
    • 2015-06-29
    • 1970-01-01
    • 1970-01-01
    • 2012-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多