alejandro carnero
alejandro carnero

Reputation: 1784

rdlc REPORTPARAMETER INT , report doesn't appear

I have written this procedure :

   alter proc rel_geralAC (@emite int, @mes char, @ano varchar(4) )as
   select Total_Mun = COUNT(xMunIni),xMunIni ,
   UF = MAX(UFIni) ,Valor_Total = SUM(CAST(vTPrest AS MONEY) ) 
   from CTRC where EMITENTE= @emite   and
   MONTH(emissaodata)=@mes and status = 'A' 
   and YEAR (EMISSAODATA)= CONVERT (int,@ano) 
   group by xMunIni order by UF,xMunIni 

This proc returns a table not empty , I use it to create a dataset to fill a rdlc report in C# the dataset returns information enter image description here

I have declared the parameters in the report data

enter image description here

and this is the code of the reportviewer :

 ReportParameter[] p = new ReportParameter[3];
     p[0] = new ReportParameter("emite",EEmit.ToString());
     p[1] = new ReportParameter("mes", emes.ToString());
     p[2] = new ReportParameter("ano", eano.ToString());
     reportViewer1.LocalReport.SetParameters(p);
     this.rel_geralACTableAdapter.Fill(this.ifdcontroladoria3DataSet.rel_geralAC,EEmit,emes,eano);
     this.reportViewer1.RefreshReport();

Why doesn't the report show anything? Thanks.


I have deleted the dataset and built again , creating the 3 parameters like text, if I choose integer , the query doesn't work , report parameter only accepts string, but the parameters may be

text,boolen,date/time,integer,float.

Upvotes: 0

Views: 2061

Answers (2)

Jake.NET
Jake.NET

Reputation: 21

//You're missing a line:

reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p });

//Since you are adding your parameters to a parameter array, you can put the parameter array in //the set parameters class.

//I typically do

ReportParameter rp = new ReportParameter("ParameterName", "yourtextvalue.text", false);

//repeat again (rp2, rp3, rp4 etc...)

//Then call the last statement

reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp2, rp3, rp4 });

Upvotes: 2

Eli
Eli

Reputation: 1

You have to add "false" for Definition all parameters for example:

p[0] = new ReportParameter("emite",EEmit.ToString(),false);

Upvotes: 0

Related Questions