【发布时间】:2010-05-12 09:20:35
【问题描述】:
我想从光标中获取 Count 列的值。
public Cursor getRCount(String iplace) throws SQLException
{
try {
String strSql = "SELECT COUNT(_id) AS RCount FROM tbName WHERE place= '" + iplace + "'";
return db.rawQuery(strSql, null);
} catch (SQLException e) {
Log.e("Exception on query", e.toString());
return null;
}
}
我试图从光标中获取此计数列值,如下所示
Cursor cR = mDbHelper.getRCount(cplace);if (cR.getCount() > 0){long lCount = cR.getLong(0);}cR.close();}
我得到了调试错误。如何得到它?
PS:我可以使用嵌套游标吗?
【问题讨论】:
-
你确定这是 .NET 吗?它看起来像 Java。