语句cursor.getstring(cursor.getcolumnindex(“id”))不检索与“id”相关的正确数据,而是从数据库中检索错误的数据?是什么原因?如何解决这个问题呢?
示例代码如下: Uri uri = Uri.parse(CONTENT_URI +“/”+ code);
Cursor cursor = managedQuery(uri,null,null,null,null);
if(cursor.getCount()> = 1){
cursor.moveToFirst();
String convValue = cursor.getString(cursor.getColumnIndex(“id”)); outText.setText(将String.valueOf(convValue));
} 别的{
throw(new Exception(“code invalid”));
}