One easy way to do this is to change the query to access one or two Tempvars variable(s), and set the same Tempvars in each case before calling the query.
If you want to be able to use the same query to get a single student or all students, then you can either use
Code:
WHERE StudentID BETWEEN X AND Y
and for a single student, set Tempvars X and Y both to the student ID, and for all students, set them equal to the low and high student IDs in the database.
Alternately, you could use
Code:
WHERE StudentID LIKE X
and for a single student, set Tempvars X to the student ID, and for all students, set it to *.