Can you try this with HQL, so that I better understand the issue?

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Wed, Jul 8, 2009 at 1:23 PM, benArrayx <[email protected]> wrote:

>
> Hi there, I'm using NHibernate 1.2.0.4 on SQL Server 2005. I am using
> a Criteria query with a clause as follows:
>
> crit.Add(new NHibernate.Expression.LeExpression("PartnershipDate", new
> DateTime(DateTime.Now.AddYears(lengthOfMarriage * -1).Year,
> DateTime.Now.Month, DateTime.Now.Day)));
>
> This generates the following log entry sql (I've replaced the field
> names with * for clarity):
>
> SELECT * FROM WPR_Test.dbo.[MP] this_ WHERE this_.[IsImportTemp] = @p0
> and this_.[PartnershipDate] <= @p1; @p0 = 'False', @p1 = '08/07/2006
> 00:00:00'
>
> However, this query is not generating the expected results. Using sql
> profiler, I checked the actual statement run, which is this:
>
> exec sp_executesql N'SELECT * FROM WPR_Test.dbo.[MP] this_ WHERE this_.
> [IsImportTemp] = @p0 and this_.[PartnershipDate] <= @p1',N'@p0 bit,@p1
> datetime',@p0=0,@p1='2006-07-08 00:00:00:000'
>
> As you can see, the date '2006-07-08 00:00:00:000' from profiler does
> not match the date from the log which is '08/07/2006 00:00:00' as the
> profiler query is saying the 7th August, whereby the log query is
> saying the 8th July.
>
> Obviously this is a simple mis-formatting, I have all the source code
> for the version I'm using, but I can't find where this formatting
> happens to correct it. If anyone could point me at the relevant part
> of the code I'd appreciate it :)
>
> Regards, Ben
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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