I have make a report with one procedure, loading a dataset, the report is working fine with this code:
ReportParameter[] p =newReportParameter[1]; p[0]=newReportParameter("cnpj",cnpj);this.reportViewer1.LocalReport.SetParameters(p);this.cargaPJTableAdapter.Fill(this.ifdcontroladoria3DataSet1.cargaPJ,cnpj);this.reportViewer1.RefreshReport();
my question is, I have add a second dataset based on another procedure named
cargaEND. How do I call the second dataset and pass the parameter to the second procedure? I have tried this with no sucess:
None
0 Points
2 Posts
passing dataset to report viewer
Apr 18, 2013 09:28 AM|ahmedmii|LINK
hello guys,
I'm passing dataset to report viewer, but there're no data in the report?
This is the code I found in your fourm.
SqlConnection con = new SqlConnection();
protected void Page_Load(object sender, EventArgs e)
{
con.ConnectionString = connection.x;
con.Open();
if (!Page.IsPostBack)
{
runRptViewer();
}
}
private DataTable getData()
{
DataSet1 dss = new DataSet1();
string sql = "";
sql = "SELECT product_id, product_name from product";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
da.Fill(dss);
DataTable dt = dss.Tables[0];
return dt;
}
private void runRptViewer()
{
this.ReportViewer1.Reset();
this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report1.rdlc");
ReportDataSource rds = new ReportDataSource("DataSet1", getData());
this.ReportViewer1.LocalReport.DataSources.Clear();
this.ReportViewer1.LocalReport.DataSources.Add(rds);
this.ReportViewer1.DataBind();
this.ReportViewer1.LocalReport.Refresh();
}
Member
141 Points
92 Posts
Re: passing dataset to report viewer
Apr 18, 2013 09:45 AM|santosh.poojari|LINK
Refer this for more help.
http://www.codeproject.com/Articles/31862/Dynamic-Binding-Of-RDLC-To-ReportViewer
None
0 Points
2 Posts
Re: passing dataset to report viewer
Apr 18, 2013 09:56 AM|ahmedmii|LINK
it's different from the code I put. I used sql query and the website you put sql paramenter?
I don't know who it's going to help.
Member
40 Points
24 Posts
Re: passing dataset to report viewer
Apr 21, 2013 01:02 PM|ValBavaria|LINK
I have make a report with one procedure, loading a dataset, the report is working fine with this code:
my question is, I have add a second dataset based on another procedure named
</div>cargaEND
. How do I call the second dataset and pass the parameter to the second procedure? I have tried this with no sucess: