Passing dates as parameters
Posted: Wed May 18, 2011 3:29 am
Hi.
I am trying to pass dates as parameters to my mySQL report. After going through the forums, I have taken these steps:
1. In the SQL query, we have to prefix an @ in the parameter. I have done this and this is my query:
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between @DateBegin and @DateEnd
2. In the DataSource dialog, I have defined 2 parameters DateBegin and DateEnd and defined their datatype as DateTime.
3. I have then declared 2 variables FromDate and ToDate. I have given their default values as 1/1/1970 0:00:00 AM.
4. I have assigned the expression values of the DateBegin and DateEnd parameters as FromDate and ToDate respectively.
5. I am passing the parameter values in the format of YYYYDDMM.
This is my hyperlink:
http://localhost/quickstart/stimulsoft/ ... d=20110601
When I run this query in my database, I get back 3 rows
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between 20110501 and 20110601
But, in the report no rows are getting returned. What could be the issue?
Thanks in advance for any help.
I am trying to pass dates as parameters to my mySQL report. After going through the forums, I have taken these steps:
1. In the SQL query, we have to prefix an @ in the parameter. I have done this and this is my query:
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between @DateBegin and @DateEnd
2. In the DataSource dialog, I have defined 2 parameters DateBegin and DateEnd and defined their datatype as DateTime.
3. I have then declared 2 variables FromDate and ToDate. I have given their default values as 1/1/1970 0:00:00 AM.
4. I have assigned the expression values of the DateBegin and DateEnd parameters as FromDate and ToDate respectively.
5. I am passing the parameter values in the format of YYYYDDMM.
This is my hyperlink:
http://localhost/quickstart/stimulsoft/ ... d=20110601
When I run this query in my database, I get back 3 rows
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between 20110501 and 20110601
But, in the report no rows are getting returned. What could be the issue?
Thanks in advance for any help.