sql server ce - CSHTML/SQL SUM For A Row -


i know in mysql sum(size), reason building in razor cshtml not same , cant find anywhere talks adding or subtracting 2 numbers in cshtml. right function use add rows size?

code:

@{     page.title = "home @";     var pagetitle = "home";      var db = database.open("photogallery");     var shows = db.query(@"select * shows").tolist();     var seasons = db.query(@"select * seasons").tolist();     var episodes = db.query(@"select * episodes").tolist();     var comics = db.query(@"select * comics").tolist();     var artists = db.query(@"select * artists").tolist();     var albums = db.query(@"select * albums").tolist();     var comicsize = db.query(@"select sum(size) 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: specified argument value function not valid. [ argument # = 1,name of function(if known) = sum ] 

if you're interested in count of each table should select count(*) shows , forth rather pulling data each table count.

@{     page.title = "home @";     var pagetitle = "home";      var db = database.open("photogallery");     var shows = (int)db.queryvalue(@"select count(*) shows");     var seasons = (int)db.queryvalue(@"select count(*) seasons");     var episodes = (int)db.queryvalue(@"select count(*) episodes");     var comics = (int)db.queryvalue(@"select count(*) comics");     var artists = (int)db.queryvalue(@"select count(*) artists");     var albums = (int)db.queryvalue(@"select count(*) albums");     var comicsize = (int)db.queryvalue(@"select sum(size) comics");        var totalsizeb = comicsize; }  <h1>@pagetitle</h1> <p align="center">     @shows tv shows | @seasons seasons | @episodes episodes | @comics comics | @artists artists | @albums albums<br />       bytes |  mb |  gb |  tb </p> 

sum works numeric types such int, numeric, money, , float make sure column 1 of types in table.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -