Rhyno_H
Rhyno_H

Reputation: 49

Counting the amout of true elements in a sql to ling table

I'm trying to see how many have paid in full, the paid in full is a bit, but Visual Studio and Linq converts it to a bool?

The code below wont work unless I cast it but how do I cast it? I have tried multiple ways.

int i = (from c in YSA.YSAs
                where c.YSA_PAID_FULL = true
                select c).Count();

Upvotes: 2

Views: 63

Answers (2)

Soner Gönül
Soner Gönül

Reputation: 98868

Looks like you should use == operator

where c.YSA_PAID_FULL == true

Like;

int i = (from c in YSA.YSAs
                where c.YSA_PAID_FULL == true
                select c).Count();

Upvotes: 1

Habib
Habib

Reputation: 223422

You need == not =

int i = (from c in YSA.YSAs
         where c.YSA_PAID_FULL == true
         select c).Count();

Upvotes: 2

Related Questions