I’ve met an issue at attempt to request data from MySql database.
For instance:
I have a table user_data which contains lots of fields including user_id which is string and day which is date. At attempt to request data using manually created SQL query:
SELECT * FROM `alt_database`.`user_data`
where user_id = '54sdfjghwegFDqwgf' and day = '2011-10-31';
It retrieves everything fine. But at attempt to request the same data using Nhibernate:
string customer_id = "54sdfjghwegFDqwgf";
DateTime DT = DateTime.Parse("2011-10-31");
var criteria = TheSession.CreateCriteria(typeof(user_data));
criteria.Add(Restrictions.Eq("user_id", customer_id) & Restrictions.Eq("Day", day))
.List<user_data>();
It retrieves 0 records.
Any help would be appreciated.
Thanks in advance.
Dmitry
Thanks to everyone who tried to help me out!
Unfortunately, I had to use raw sql query: using CreateSQLQuery and then adding Scalars for each field.