InventSum inventSum; ; ... while(QueryRun.next()) { inventSum = QueryRun.get(tablenum(InventSum)); ..... }