SQLite rawquery selectionArgs无法正常工作

时间:2011-06-06 22:46:56

标签: android sqlite

我得到了以下rawquery

private static final String DB_QUERY_GETPOS = "select f._id, F.FName, F.FArt, P.VName, O.Gebaeude, O.Raum from Faecher as F " 
                                                     + "inner join profs as P on F.Prof_ID = P._id " 
                                                     + "inner join ort as o on F.ort_id = o._id " 
                                                     + "inner join position as PO on PO.pos=? and id is not null where f._id = PO.id and PO.pos=? order by f._id;";

为什么在访问填充了此查询结果的Cursor或ArrayList对象时会出现ArrayOutofBounds异常?

为什么?参数没有拿到我传递给rawquery的参数?

1 个答案:

答案 0 :(得分:1)

在Android中使用游标时,请记住在读取数据之前使用moveToFirst函数。否则会导致ArrayOutOfBounds异常。