Posted on: 5/16/2014 3:05:04 AM | Views : 264

When I run the following code in ssms, it works. It gives me the vote count for each candidate and the percentage for that vote count.
select DISTINCT count( IsNull(er.candidateId,0)) OVER (Partition by o.orgName, p.Position, c.candidateName,p.PositionId ) as VoteCount, CAST(count( IsNull(er.candidateId,0)) OVER (Partition by o.orgName, p.Position, c.candidateName,p.PositionId ) *1./count( IsNull(er.candidateId,0)) OVER (Partition by p.Position)*100 as decimal(6,2)) as Percentage from Organizations o inner join Positions p on o.OrgID = p.OrgID inner join Candidates c on p.positionId = c.positionId inner join ElectionResults er on c.candidateId = er.candidateId When I try to integrate the code with my rest of my .net code, each candidate gets 100% regardless of vote count.
Can any of you gurus please give me a hand on this?
Protected Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e ...

Go to the complete details ...