SSRS ReportViewer problems with XML embedded data source

前端 未结 3 809
北荒
北荒 2021-01-26 03:41

I have C# (WPF) application where I want to display a SSRS report in the ReportViewer control. The local report file has XML datasource embedded in it. The report is displayed c

3条回答
  •  无人及你
    2021-01-26 04:20

    I have a small command line app that does something similar, but between defining the report path and doing anything with the report viewer I'm setting a data source for the report to be run against:

    report.DataSources.Add(new ReportDataSource("DataSet_for_Distribution", table));
    

    ...table is a DataTable.

    After that I have no problems programmatically calling the report Render method.

    Can you set a break before the render and see what data sources the report actually has?

    Another thing to try, and it may just be that you formatted (or stack formatted ) it to post it here, but when I embed an XML data set in a report it is all using a format like this:

    <Query>
        <ElementPath>Root /S  {@OrderDate (Date), @TotalDue (Decimal)} /C {@LastName} </ElementPath>
        <XmlData>
        <Root>
        <S OrderDate="2003-07-01T00:00:00" SalesOrderNumber="SO51131" TotalDue="247913.9138">
          <C FirstName="Shu" LastName="Ito" />
        </S>
        <S OrderDate="2003-10-01T00:00:00" SalesOrderNumber="SO55282" TotalDue="227737.7215">
          <C FirstName="Shu" LastName="Ito" />
        </S>
        <S OrderDate="2002-07-01T00:00:00" SalesOrderNumber="SO46616" TotalDue="207058.3754">
          <C FirstName="Jae" LastName="Pak" />
        </S>
        <S OrderDate="2002-08-01T00:00:00" SalesOrderNumber="SO46981" TotalDue="201490.4144">
          <C FirstName="Ranjit" LastName="Varkey Chudukatil" />
        </S>
        <S OrderDate="2002-09-01T00:00:00" SalesOrderNumber="SO47395" TotalDue="198628.3054">
          <C FirstName="Michael" LastName="Blythe" />
        </S>
        </Root>
        </XmlData>
        </Query>
    

提交回复
热议问题