Getting the wrong count?
<p>I am getting the wrong count error and I can't figure out why.</p>

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

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

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

<p>What's wrong in my code?</p>

<p>Can you please help me?</p>
