Here is my sql:

SELECT  *        FROM   dbo.[Certco$Sales Price]
        WHERE   ([Sales Type] = 1) AND ([Sales Code] = 'CONVENTNL') AND
                ([Item No_] = @ItemNo) AND [Starting Date] <=
@Currentdate AND ([Ending Date] >= @Currentdate OR
                                                       [Ending Date] =
'01/01/1753')



Here is my code to return this SQL in NHIBERNATE

 using (ISession session = FactoryCreatorHelper.OpenSession())
            {

                                ICriteria crit =
session.CreateCriteria<Certco_SalesPrice>();
                crit.Add(Restrictions.Eq("salestype",1));
                crit.Add(Restrictions.Eq("salescode", "CONVENTNL"));
                crit.Add(Restrictions.Eq("itemno_", acode));
                crit.Add(Restrictions.Le("startingdate",starttime));
 
crit.Add(Restrictions.Or(crit.Add(Restrictions.Ge("endingdate",DateTime.Today)),crit.Add(Restrictions.Eq("endingdate",DateTime.Today))));
               // IList<Certco_SalesPrice> alist =
crit.List<Certco_SalesPrice>();
            }

My problem is on the OR statement.    I love the NHIBERNATE syntax but
I am new and it takes some getting used to.  How do I do an OR sql
statement in this way?

Are there any good references on writing HQL?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to