0

hey all,

i got problem about count method. for example, there are three students(a,b,c), and there are two courses(coure1,course2), then student a and b enrol course1, and student c enrol course 2. i need to count how many students enrolled course1.

Public Function numStudents() As Integer
        'return number of students enrolled in this course 

        Return myEnrols.Count
    End Function

so how to write this function.thank you very much.

5
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by Netcode
0

The question is: how do you store the courses for students?
like does every student have a property list(of courses)?

0

yes. when students enrol course1, i need to count how many students enrolled course1.
how to store the courses for students, and how to count how many students enrolled this course. like, there are three students enrolled course1, the function should reture 3(because there are 3 students enrolled this course). how to do this?
thanks

0

What database?

If MS SQL, you can simply use the below query

Dim StringCount as string = "SELECT COUNT from CourseEnrolled where Course_ID IN (csc01,csc02,csc03)"
0

What database?

If MS SQL, you can simply use the below query

Dim StringCount as string = "SELECT COUNT from CourseEnrolled where Course_ID IN (csc01,csc02,csc03)"

Did you mean

select count(*) from CourseEnrolled where Course_ID = 'csc01'

?

0

Did you mean

select count(*) from CourseEnrolled where Course_ID = 'csc01'

?

thanks for the code edit. Missed the wildcard

Edited by Netcode: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.