passing dataset to report viewer RRS feed

  • Question

  • User-470983441 posted

    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;

    if (!Page.IsPostBack)

    private DataTable getData()
    DataSet1 dss = new DataSet1();
    string sql = "";
    sql = "SELECT product_id, product_name from product";
    SqlDataAdapter da = new SqlDataAdapter(sql, con);
    DataTable dt = dss.Tables[0];
    return dt;

    private void runRptViewer()
    this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report1.rdlc");
    ReportDataSource rds = new ReportDataSource("DataSet1", getData());

    Thursday, April 18, 2013 9:28 AM

All replies

  • Thursday, April 18, 2013 9:45 AM
  • User-470983441 posted

    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.

    Thursday, April 18, 2013 9:56 AM
  • User589263704 posted

    I have make a report with one procedure, loading a dataset, the report is working fine with this code:

    ReportParameter[] p = new ReportParameter[1]; p[0] = new ReportParameter("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:

    Sunday, April 21, 2013 1:02 PM