Page 1 of 1

Custom Views and Execute Scalar

Posted: Tue Jun 11, 2024 2:18 am
by FedeLopez

Hi everyone... I had a page that add some Code to a file depend on max/min table values.
The page was a DataBase View, something like any sports standings, resalting best and worse teams.
Thing is that my free server hosting doesn't allow Database Views to be stored.. so I had to move the view to a Custom View.
The problem came later... I did calculate MAX and MIN values of each column using ExecuteScalar against DataBase view, but I can't run ExecuteScalar against a Custom View, didn't?
So... how can i calculate the max value in each column to Highlight them?
P. e.
Rank - PlayerName - Points - Assists
1st - Peter - 20 (Max) - 15
2nd - John - 19 - 12 (Lower)
3rd - Astrid - 15 (Lower) - 18 (Max)

Thanks in advance


Re: Custom Views and Execute Scalar

Posted: Tue Jun 11, 2024 8:32 am
by arbei

FedeLopez wrote:

but I can't run ExecuteScalar against a Custom View, didn't?

No, the Custom View is only a SQL, it does not exists in the database, but you only need to change the FROM clause to the actual table in your database.

It is recommended that you upgrade to a hosting plan that support database views in the long run.