-1

DB から TotalCount を収集しようとしていますが、クエリに問題があり、それを理解できないため、収集できません。以下は私のクエリです:

public int getIds()
               {
                   String strCount = "";
                   int count = 0;
                   Cursor c = database.rawQuery("SELECT COUNT(Pst_id) AS CountTotal FROM student_posts", null);

                   while(c.moveToFirst())
                   {
                   strCount = c.getString(c.getColumnIndex("CountTotal"));
                   }
                   count = Integer.valueOf(strCount).intValue();
                   return count;                       
               }
4

1 に答える 1