I have problems comparing the datetime property of objects and when trying to
compare to a given date. For example, I tried
IQuery query1 = session.CreateQuery(String.Format(
@"Select s.Id
From InventoryProductStateItem s
Where s.ValidFrom = " + stateItem.ValidFrom));
but get an exception “Incorrect syntax”.
Dates can be compared by passing a parameter to the query: