我用下面的代码获取行数,但是程序被挂起。怎么回事呢?
private int countbaglist()
{
int count = 0;
SQLiteDatabase db = datasource.getWritableDatabase();
Cursor cursor = db.rawQuery(
"select count(*) from shoplist where itemname=?",
new String[] { String.valueOf("itemname") });
while(cursor.moveToFirst())
{
count = cursor.getCount();
}
return count;
}