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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:14:14+00:00 2026-06-12T03:14:14+00:00

I am getting the wrong count error and I can’t figure out why. In

  • 0

I am getting the wrong count error and I can’t figure out why.

In my database serverId = 1/2/3 has only one started value and 3 notstarted value for each server.

painfo = (from paes in server.AppPM_Paes
          where (paes.PaStatus == "Started" || paes.PaStatus == "NotStarted" ) && paes.ServerId != null
          select new PaDetails { ServerID = paes.ServerId, PaStatus = paes.PaStatus }).ToList();
foreach (PaDetails a in painfo)
{
    if (a.PaStatus.Contains("Started") && a.ServerID.Equals(1))
        stCount1++;
    if (a.PaStatus.Contains("Started") && a.ServerID.Equals(2))
        stCount2++;
    if (a.PaStatus.Contains("Started") && a.ServerID.Equals(3))
        stCount3++;
    if (a.PaStatus.Contains("NotStarted") && a.ServerID.Equals(1))
        notStCount1++;
    if (a.PaStatus.Contains("NotStarted") && a.ServerID.Equals(2))
        notStCount2++;
    if (a.PaStatus.Contains("NotStarted") && a.ServerID.Equals(3))
        notStCount3++;                    
}       

But in my above code (stCount#->started count), stCount# has the value 4 instead of 1.

What’s wrong in my code?

Can you please help me?

  • 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-06-12T03:14:16+00:00Added an answer on June 12, 2026 at 3:14 am

    You’re doing a .Contains("Started"). This will include any string that has the word “Started” in it, including “NotStarted”

    You can change it to a.PaStatus == "Started" or a.PaStatus.Equals("Started")

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

Sidebar

Related Questions

I'm getting a syntax error on this query, but I can't figure it out.
I am getting the following error: I can't seem what is wrong with my
I keep getting this stored procedure error (wrong number or types of the arguments)
Am getting this error message and matched my brackets and couldn't find anything wrong.
I have some code that's currently giving me an error, because recur can only
Can any one please suggest me whats the wrong with my query. SELECT SUM(cCallDuration),
Can someone tell what is wrong with this query? sqltext = SELECT utyp, count(*)
When trying to add a few items to the database I'm getting this error:
I am getting a Wrong type argument: commandp, (lambda nil (forward-line 5)) here. (global-set-key
I am getting a wrong output when i alert this, it shows '01' <input

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.