Hi all,
I am writing a page to display the people registered for a selected course, and the people that are on the waitinglist.
I do this using various GridViews bound to SqlDataSources. The courses table has a "Maximum" field for every course, which says how many people can participate. When more register, they are put on the waitinglist.
To show the list of participants, I use a SqlDataSource with SelectCommand "SELECT TOP(@max) ..." to leave off the ones on the waiting list.
Problem now is when a course has not defined the maximum number of participants, i.e. Maximum contains NULL. How should I handle this situation?
In a related problem, to show the waitinglist, I use "SELECT TOP(@amount-@max) ..." where @amount is determined by a COUNT(*) subquery counting the number of registrations for a selected course. However, when @amount < @max, I get a negative value for TOP and an error message. How should I handle this?
Should I use DataBinding event triggers to modify the SelectCommand parameter?
Thanks, Peter
I am writing a page to display the people registered for a selected course, and the people that are on the waitinglist.
I do this using various GridViews bound to SqlDataSources. The courses table has a "Maximum" field for every course, which says how many people can participate. When more register, they are put on the waitinglist.
To show the list of participants, I use a SqlDataSource with SelectCommand "SELECT TOP(@max) ..." to leave off the ones on the waiting list.
Problem now is when a course has not defined the maximum number of participants, i.e. Maximum contains NULL. How should I handle this situation?
In a related problem, to show the waitinglist, I use "SELECT TOP(@amount-@max) ..." where @amount is determined by a COUNT(*) subquery counting the number of registrations for a selected course. However, when @amount < @max, I get a negative value for TOP and an error message. How should I handle this?
Should I use DataBinding event triggers to modify the SelectCommand parameter?
Thanks, Peter