Convert SQL to HQL for NOW() -


please in converting below sql query hql

 select * invoice invoice_date > now() - interval 7 day  

system throwing error now()

i recommend use parameters iquery

you should

var q = nhsession.createquery("from invoice invoice_date > :date"); q.setparameter("date", datetime.now.adddays(-7)); q.list... 

edit

if application server (c# app) different sql server , have different timezones can do:

  1. use utc , keep code above
  2. use straight tsql (for getdate() function) in isqlquery

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -