Hello,
I have a c# app that is trying to return data from a mysql database with criteria between two dates. I have the following code set up -
Code:
public IList<myObject> GetmyObjectBetweenDateRange(DateTime fromDate, DateTime toDate)
{
return _session.CreateCriteria(typeof(myObject))
.Add(Expression.Gt("dateTime", fromDate))
.Add(Expression.Lt("dateTime", toDate))
.List<myObject>();
}
This code is not returning any data. I have my config file set to show sql. below is the sql that is running (from the output window) -
Code:
NHibernate: SELECT this_.he_id as he1_0_0_, this_.he_dateTime as he2_0_0_, this_.he_clocation_id as he3_0_0_, this_.he_nact_length as he5_0_0_, this_.he_order as he6_0_0_, this_.he_ntype as he7_0_0_, this_.he_roomid as he8_0_0_, FROM myTable this_ WHERE this_.he_dateTime > ?p0 and this_.he_dateTime < ?p1 ;?p0 = 12/1/2009 12:00:00 AM, ?p1 = 12/21/2009 12:00:00 AM
I run this in the query window as the following query -
Code:
SELECT this_.he_id as he1_0_0_, this_.he_dateTime as he2_0_0_, this_.he_clocation_id as he3_0_0_, this_.he_order as he6_0_0_, this_.he_ntype as he7_0_0_, this_.he_roomid as he8_0_0_, this_.he_mftrlogsheetname as he9_0_0_, this_.he_ccalendar_num as he10_0_0_ FROM myTable this_ WHERE this_.he_dateTime > '12/1/2009 12:00:00 AM' and this_.he_dateTime < '12/21/2009 12:00:00 AM'
When I run the query, I am getting the expected result set. does anyone have any idea why I am able to run the query in the query window for mySql and get the expected data, but when the query is run in the application, I am getting no data.
Thanks for any thougths