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 5951975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:36:54+00:00 2026-05-22T17:36:54+00:00

I have a C# Windows app with an SQL table holding voter information. One

  • 0

I have a C# Windows app with an SQL table holding voter information. One of the stored fields is ‘Party’ with stored values of ‘Dem’, ‘Rep’, ‘Ind’, ‘Other’. I want to total by these values and use the count function to show total of all records. I know how to use count to get the total of all the records in the the record set but how do you count each value in the field.

I have a form with textboxes for Total Records, Total Dem, Total Rep, Total Ind and Total Other. There is a list box with radio buttons. The default button is ‘All’ showing all records. There is a radio button for each of the values (Dem, Rep, Ind and Other). When the radio buttons are selected the list is narrowed by the selection. The total in the textboxes does not change and always shows the total for each value.

Thanks in advance.

  • 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-22T17:36:54+00:00Added an answer on May 22, 2026 at 5:36 pm

    A straightforward way would be to build a scalar function for each count. Something like

    select @return = count(party) where party = 'Dem'
    

    And then a view that holds the counts for each party. There are more performant ways to do this but from your question it sounds like your just getting up off the ground and this would probably be the most straightforward way for you.

    Learn about scalar functions here:
    http://msdn.microsoft.com/en-us/library/ms186755.aspx

    And views here:
    http://msdn.microsoft.com/en-us/library/ms187956.aspx

    A better way (for the database) would be to build a view that uses “group by” but it would return rows instead of columns which will create a little more work for you when setting the values to each of your c# controls.
    http://msdn.microsoft.com/en-us/library/ms177673.aspx

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

Sidebar

Related Questions

I have Windows Vista MCML app, and I need to figure out the current
I have a Windows Form app written in C#. Its job is to send
I have a Windows Forms app, that has a single ElementHost containing a WPF
I have a windows forms app with a textbox control that I want to
I have a Windows 6 app I am developing (in VB). I am pulling
I have created a windows installer for a windows forms app as an MSI.
I have to perform 3 operations in a windows app as a Transaction. These
I am developing a small windows app, but have some trouble deciding whether to
I've had a Windows app in production for a while now, and have it
I have a pretty basic windows form app in .Net. All the code is

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.