none
Passing ReportDataSource as XML string to SSRS LocalReport (.rdlc) RRS feed

  • Question

  • I am using Microsoft.ReportViewer.WebForms, Version=15.0.0.0 for generating report from SSRS report. I have tried passing XML string as Report Data source to LocalReport, but report generates empty values of passed DataSet.

    I have tried this:

     localReport.DataSources.Add(new ReportDataSource 
     {
       Name="DataSourceNameInRdlc",
       Value= @"<Clients>
                 <Client>
                  <Name>Client Name</Name>
                 </Client>
               </Clients>" 
     });

    However it perfectly working with:

      public ReportDataSource(string name, DataTable dataSourceValue); 

    public ReportDataSource(string name, IEnumerable dataSourceValue);

    But not working with this when pass XML as string:       

     public ReportDataSource(string name, object dataSourceValue);


    • Edited by Tanmay Mule Friday, September 20, 2019 8:11 AM Corrected the code
    Wednesday, September 18, 2019 6:53 AM

All replies

  • Hi Tanmay Mule,

    Could you elaborate your issue a little bit?  Could you post more context of your code, it is a little confusing for me. Did you mean whole xml batch as string of dataSourceId? How are the "working" constructors?

    You could take a look at this thread, perhaps it could help: Passing XML into a SSRS report from c#

    Lukas


    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.




    Thursday, September 19, 2019 1:56 AM
  • I have updated the code.

    I am trying to pass XML using below constructor.

    public ReportDataSource(string name, object dataSourceValue);


    TSM

    Friday, September 20, 2019 8:12 AM
  • This looks exactly the same as the code in official doc, we can not address any error info from this.

    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 23, 2019 5:32 AM