Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

Where clause works with hard coded values but not values from variables

$
0
0

Hi,

got a strange problem I hope someone can help with, I'm filtering some pages like this:

 

Model.Content.Children.Where("Visible && articleDate.Year == DateTime.Now.Year && articleDate.Month == 12")

This work fine but if i put a variable in place of 12 for the month it never returns any results eg:

var queryMonth = DateTime.Now.Month;

Model.Content.Children.Where("Visible && articleDate.Year == DateTime.Now.Year && articleDate.Month == queryMonth")

 

I've checked that queryMonth does contain 12, tried converting the type. whatever I've tried only works with 12 hard coded, any help much appreciated.

 

Regards


 


Viewing all articles
Browse latest Browse all 72689


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>