-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: IQuery problem
PostPosted: Thu Jun 15, 2006 5:41 am 
Newbie

Joined: Thu Jun 15, 2006 5:27 am
Posts: 13
Hello, I'm a newbie to NHibernate. I tried examples projects with Console Application and it worked fine. I'm now trying to do a web application example but I've got a query problem.

In console applications, I was using session.Find() with where clause and it was workin, now I tried to use session.CreateQuery() with where clase and it doensn't work normally. It give me all the results without caring about the where clause.

This is the source code:

Code:
public void PrintEntries(DateTime date, GridView gv)
        {
            using (ISession session = sessionFactory.OpenSession())
            using (ITransaction tx = session.BeginTransaction())
            {
                IQuery cq = session.CreateQuery("from Collabs as c where c.Date < :Date");
                cq.SetDateTime("Date", date);
                gv.DataSource = cq.List();
                gv.DataBind();
                tx.Commit();
            }
        }


Code:
agence.PrintEntries(DateTime.Parse("21 / 03 / 2006"), GridView1);


I need help please.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.