Jump to content
We've recently updated our Privacy Statement, available here ×

Passing a date param to sql Query


totalylouco

Recommended Posts

Hello, Im creating a report in IReport 2.0.4, my problem is that I want to pass a param (or create a date) in the sqlQuery

 

Code:
SELECT count(*) as value_  FROM SociosApartamentos
where codModalidade=$P{idModalidade}
AND dataInicio)<=$P{data} AND dateadd('d',nDias,dataInicio)>$P{data}

 

But this does not work.

I also tried to pass the day month and year and create a string the represents the date but it wasnt sucesful also.

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

What do you mean, "it doesn't work"? Does it get no results? Does it create a stack trace? If there are relevant errors or logs, please post them.

 

First thing I'd recommend that you check is that you've set the data type correctly on the parameter. Depending on which RDBMS you are using, you will want Date, Timestamp, or possibly Long.

 

Kind regards,

Justis

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...