Could be... In my world, everything is date & time, so I assume the same for everyone else.
On Sun, Apr 4, 2010 at 8:27 AM, Fabio Maulo <[email protected]> wrote: > Ok Jason but I'm pretty sure that his original problem is in the mapping. > Daoming, > What mean DateCreated for you ? > How look DateCreated mapping ? > > 2010/4/3 Jason Dentler <[email protected]> > > This isn't much of an NH problem. The database is storing a date and time, >> so you should query it as a date and time, not just a date. >> >> Your first query is close... I think it should be Between(date.Date, >> date.Date.AddDays(1)). This would also include orders from exactly midnight >> the next day, so that's no good. >> >> You want this: >> >> DateCreated >= date.Date And DateCreated < date.Date.AddDays(1) >> >> I'll leave the translation to criteria for you. >> >> >> On Sat, Apr 3, 2010 at 6:05 AM, Daoming Yang >> <[email protected]>wrote: >> >>> How I can lookup a specific date in Nhibernate? >>> >>> I'm currently using this to lookup one day's order. >>> >>> ICriteria criteria = >>> SessionManager.CurrentSession.CreateCriteria(typeof(Order)) >>> >>> >>> >>> .Add(Expression.Between("DateCreated", date.Date.AddDays(-1), >>> date.Date.AddDays(1))) >>> >>> >>> >>> .AddOrder(NHibernate.Criterion.Order.Desc("OrderID")); >>> >>> >>> I tried the following code, but they did bring the data for me. >>> >>> Expression.Eq("DateCreated", date) >>> >>> >>> >>> Expression.Like("DateCreated", date) >>> >>> >>> *Note:* The pass in date value will be like this 2010-04-03 00:00:00, >>> >>> The actual date value in the database will be like this 2010-03-13 >>> 11:17:16.000 >>> >>> Can anyone let me know how to do this? >>> >>> Many thanks. >>> >>> -- >>> 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]<nhusers%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/nhusers?hl=en. >>> >> >> -- >> 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]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > > > -- > Fabio Maulo > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- 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.
