>What is the correct syntax to do something like the following?
>
>FUNCTION GetStudentCount
>LPARAMETERS tnCourseID
>RETURN SELECT COUNT(*) FROM v_students WHERE iCourseID = tnCourseID
If you're doing this with native VFP code, there's really no reason to use a SQL SELECT here:
COUNT TO nResult FOR iCourseID = tnCourseID
RETURN nResult
Do keep in mind that COUNT moves the record pointer, so you may want code to save and restore it.
Tamar