I want to generate report in win form by reportviewer user control.
my code is
public void getReportFrmServer(string report, string[] param)
{
try
{
this.reportViewer1.ServerReport.ReportPath = "/Report From_Iris_New/" + report;
this.reportViewer1.ServerReport.Timeout = 3600000;
ReportParameter[] parameter = new ReportParameter[5];
parameter[0] = new ReportParameter("startDate", param[0]);
parameter[1] = new ReportParameter("endDate", param[1]);
parameter[2] = new ReportParameter("contractorName", param[2]);
parameter[3] = new ReportParameter("siteName", param[3]);
parameter[4] = new ReportParameter("FuncName", param[4]);
this.reportViewer1.ServerReport.SetParameters(parameter);
this.reportViewer1.RefreshReport();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
in in sql function
select A. ContractorName as ContractorName,A.st as st,A.Rank as Rank ,sum(A.TWDH) as TWDH ,
sum(A.TOTH) as TOTH,
sum(A.TOTM) as TOTM,
sum(A.TOTHS) as TOTHS,
sum(A.TOTMS) as TOTMS
FROM
(
select T.ContractorName as ContractorName,T.SkillType as st,T.RankName as Rank,
T.Date as Date ,
TWDH=(case when datename(dw,convert(datetime,convert(varchar(10),T.Date,103),103))='Sunday'
then 0 else count(T.workDuration) end),
TOTH=(case when datename(dw,convert(datetime,convert(varchar(10),T.Date,103),103))='Sunday'
then 0 else sum(DatePart(HH,T.ot)) end),
TOTM=(case when datename(dw,convert(datetime,convert(varchar(10),T.Date,103),103))='Sunday'
then 0 else sum(DatePart(mi,T.ot)) end),
TOTHS =(case when datename(dw,convert(datetime,convert(varchar(10),T.Date,103),103))='Sunday'
then (sum(DatePart(HH,T.ot))+(count(T.workDuration)*8)) else 0 end),
TOTMS=(case when datename(dw,convert(datetime,convert(varchar(10),T.Date,103),103))='Sunday'
then sum(DatePart(mi,T.ot)) else 0 end)
FROM
(
SELECT * FROM BillingReport(@startDate,@endDate,@siteName)
) T
group by ContractorName,skillType,RankName,Date
)A
group by ContractorName,st,Rank
The report returns results in management studio and from the reports services (visual studio 2005), BUT:
After I deploy the project, from the browser I don't get ANY results, but this error message:
when i pass short range of date it works fine but more range like 1 month
it gives en error
An error occured during report processing.
Cannot read the next data row for the data set Dataset1.
A severe error occured on the current command. The results, if any, should be discarded.