name = namebox.getText().toString();
db.open();
Cursor c1 = db.executequery("SELECT _id FROM " + DATABASE_TABLE_CUSTOMER + " where name='" +name+"'" );
_id = c1.getInt(c1.getColumnIndex("name"));
Cursor c2 = db.executequery("SELECT amount FROM " + DATABASE_TABLE_CUSTOMER
+
" where _id=" + _id);
Double amount = c2.getDouble(c2.getColumnIndex("amount"));
Cursor c3 = db.executequery("SELECT arrear FROM " + DATABASE_TABLE_CUSTOMER + " where CUSTOMER_ID =" + _id);
arrear = c3.getDouble(c3.getColumnIndex("arrear"));
db.close();
这给了我一个错误的字段错误请求。我的适配器上的 executequery 方法如下所示:
public Cursor executequery(String query) throws SQLException
{
Cursor mCursor = db.rawQuery(query, null);
if(mCursor != null){
mCursor.moveToFirst();
}
return mCursor;
}
谁能告诉我我做错了什么。我对此很陌生。