Reputation: 2169
Code:
public static List<ExpressionListDictionary> GetAmounts()
{
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
LinqMetaData meta = new LinqMetaData(adapter);
var now = DateTime.Now;
var endDate = now;
var startDate = now.AddMonths(-3);
var datas = ( from test in meta.Test
where test.DateCreated >= startDate && test.DateCreated <= endDate && test.ViaTo > 0 && test.Cancelled == 0
select MonthOfYear(test.DateCreated)); // how can I get the month name correctly?
}
}
Cancelled
is bool TestEntity.Cancelled
I'm getting the error at the where
statement. How can I fixed it?
Upvotes: 0
Views: 1180
Reputation: 62488
Your statement after last &&
is not right you need ==
for comparing instead of =
=
do assignment in C# that's why its complaining:
&& test.Cancelled == 0
As Cancelled
is bool
you have to put true
or false
in comparison
Upvotes: 3
Reputation:
You should correct this:
&& test.Cancelled = 0
Into the following:
&& !test.Cancelled
Upvotes: 1
Reputation: 21815
As per your comment, since Cancelled
is a boolean property why you are trying to compare it with 0
? You can simply do this:-
&& test.Cancelled
Or && !test.Cancelled
for negative case.
Upvotes: 1