I know in mysql its SUM(size), but for some reason building this in razor cshtml its not the same and i cant find anywhere that talks about adding or subtracting 2 numbers in cshtml. So what would be the right function to use to add up rows size?
Code:
@{
Page.Title = "Home @";
var PageTitle = "Home";
var db = Database.Open("PhotoGallery");
var shows = db.Query(@"SELECT * FROM Shows").ToList();
var seasons = db.Query(@"SELECT * FROM Seasons").ToList();
var episodes = db.Query(@"SELECT * FROM Episodes").ToList();
var comics = db.Query(@"SELECT * FROM Comics").ToList();
var artists = db.Query(@"SELECT * FROM Artists").ToList();
var albums = db.Query(@"SELECT * FROM Albums").ToList();
var comicsize = db.Query(@"SELECT SUM(size) FROM Comics").ToList();
var totalsizeb = comicsize;
}
<h1>@PageTitle</h1>
<p align="center">
@shows.Count TV Shows | @seasons.Count Seasons | @episodes.Count Episodes | @comics.Count Comics | @artists.Count Artists | @albums.Count Albums<br />
Bytes | MB | GB | TB
</p>
Error:
Exception Details: System.Data.SqlServerCe.SqlCeException: The specified argument value for the
function is not valid. [ Argument # = 1,Name of function(if known) = SUM ]
If you’re only interested in the
Countof each table then you shouldSELECT COUNT(*) FROM Showsand so forth rather than pulling all the data from each table just to get a count.SUMonly works with numeric types such asint,numeric,money, andfloatmake sure that the column is one of those types in your table.