Pass Table valued parameter from ASP.net c# application to SSRS R2 Report

  • By following http://geekswithblogs.net/GruffCode/archive/2012/06/21/using-table-valued-parameters-with-sql-server-reporting-services.aspx%5B/url%5D I have successfully created a report that ask for multiple zip codes, as there is a long list so we are using table valued parameters as a parameter for report. This is working fine from report service URL and in Business intelligenece studio.

    Now I need to call this report from my ASP.net c# applicatiopn. I tried following and then stuck as it ask for string parameter only.

    RView.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

    RView.ServerReport.ReportServerUrl = new Uri("http://bart:85/Reports"); // Report Server URL

    RView.ServerReport.ReportPath = "/RHDCReports/NewCustomerActivityByZipCodes"; // Report Name

    RView.ShowParameterPrompts = true;

    RView.ShowPrintButton = true;

    DataTable dataTable = new DataTable("ZipCodesTable");

    dataTable.Columns.Add("ZipCode", typeof(string));

    dataTable.Rows.Add("03054");

    dataTable.Rows.Add("10583");

    Microsoft.Reporting.WebForms.ReportParameter[] Param = new Microsoft.Reporting.WebForms.ReportParameter[1];

    Param[0] = new Microsoft.Reporting.WebForms.ReportParameter("ZipCodes", dataTable);

    // Below code demonstrate the Parameter passing method. User only if you have parameters into the reports.

    Microsoft.Reporting.WebForms.ReportParameter[] reportParameterCollection = new Microsoft.Reporting.WebForms.ReportParameter[1];

    reportParameterCollection[0] = new Microsoft.Reporting.WebForms.ReportParameter();

    reportParameterCollection[0].Name = "ZipCodes";

    reportParameterCollection[0].Values.Add(??.ToString()); // here is the problem

    RView.ServerReport.SetParameters(Param);

    RView.ServerReport.Refresh();

    please help !!

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply