Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6177209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:14:08+00:00 2026-05-24T00:14:08+00:00

I know in mysql its SUM(size), but for some reason building this in razor

  • 0

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 ]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:14:08+00:00Added an answer on May 24, 2026 at 12:14 am

    If you’re only interested in the Count of each table then you should SELECT COUNT(*) FROM Shows and so forth rather than pulling all the data from each table just to get a count.

    @{
        Page.Title = "Home @";
        var PageTitle = "Home";
    
        var db = Database.Open("PhotoGallery");
        var shows = (int)db.QueryValue(@"SELECT Count(*) FROM Shows");
        var seasons = (int)db.QueryValue(@"SELECT Count(*) FROM Seasons");
        var episodes = (int)db.QueryValue(@"SELECT Count(*) FROM Episodes");
        var comics = (int)db.QueryValue(@"SELECT Count(*) FROM Comics");
        var artists = (int)db.QueryValue(@"SELECT Count(*) FROM Artists");
        var albums = (int)db.QueryValue(@"SELECT Count(*) FROM Albums");
        var comicsize = (int)db.QueryValue(@"SELECT SUM(size) FROM 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 only works with numeric types such as int, numeric, money, and float make sure that the column is one of those types in your table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that mySQL 5.x does not support INTERSECT, but that seems to be
coming from php and Mysql i know how its best done in php but
I know this should be easy but it's just not my day today. I
I know memcached but i dont familiar with mysql ndb cluster with memcached.i want
I am receiving this mysql error and i don't know why. I am following
I use MySQL extensively, but it doesn't support database-level encryption without some external library.
I wanted to know if its possible to display the contents of a mysql
i think its an regular problem, answered several times, but I just don't know
In MySQL I know its possible to select from two tables that have been
I know its a bit of a tricky question but like the information about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.