How to compare date column with current month

Hi,

I am using a select class to build a query where I have to compare date column "Net due date" with the current month.

var currentMonth = DateTime.Now.Month;

var select = new Select(UserConnection)

            .Column("Id")

            .From("UsrBeta")

            .Where("UsrDate").IsEqual(Column.Parameter(currentMonth)) as Select;

But I am getting this error : Operand type clash: date is incompatible with int

Like 0

Like

3 comments

Try this

.....

.Where(Func.Month("UsrDate")) .IsEqual(Column.Parameter(currentMonth));

Hi Grigoriy,

Thank you very much! It works

 

 

Hi Grigoriy,

I have to sum up the values of Column("Score") of several records so for this what should I use in place of Func.Month() .

Can you provide the reference for This Func method? 

Many Thanks.

Show all comments