How do Microsoft queries handle data (RDL)?

I do not create RDL from scratch, so maybe this is a problem - I am working on already prepared files.

MSDN states that the CommandText in the RDL file may contain a T-SQL query. Well, I understand that, but what else can it contain?

I ask because the phrase clearly indicates that you can put some other expression there. Therefore, if I understand correctly, I can look at the RDL code (in Visual Studio, RMB on the RDL file, "view code"), and interesting parts will be ...?

  • DataSourceName is a "link" to the database through data source definitions.
  • CommandText - I thought this was the place to place the query, for example SELECT ... but from what I see, there are no queries used
+3
source share
4 answers

Reporting service, loads the rdl file into it and starts parsing and reading the command in accordance with their sections, for example

data source, report parameters, etc.

gets parameter values ​​(if any). start using a data source database connection. run the query / sp command. receive data and store in separate data fields, which are also mentioned in rdl. associates their values ​​with controls (text box, grid columns, etc.), if there is any expression in it, execute them as well.

Create output (html / pdf).

And you go there.

. msdn .

,

+3

, .

Sth like:

ReportDataSource reportDataSource = new ReportDataSource();
reportViewer.Reset();
reportDataSource.Name = "DataSetOdczyty_klienci_adresy";
reportDataSource.Value = klienciadresyBindingSource;
reportViewer.LocalReport.DataSources.Add(reportDataSource);
reportViewer.LocalReport.ReportEmbeddedResource = "Wodociagi.Reports.ReportListaKlientow.rdlc";
+2

*.rdl XML-, Notepad ++. <DataSets>, .

  • <Fields>
  • <Query> <CommandText> <QueryParameters>,

:

  <Query>
    <DataSourceName>MyDataSource</DataSourceName>
    <CommandType>StoredProcedure</CommandType>
    <CommandText>usp_QueryCustomers</CommandText>
    <QueryParameters>
      <QueryParameter Name="@CustomerId">
        <Value>=Parameters!PersSysId.Value</Value>
      </QueryParameter>
      <QueryParameter Name="@RowsCnt">
        <Value>=Parameters!RowsCnt.Value</Value>
      </QueryParameter>
    </QueryParameters>
  </Query>

Visual Studio. , bounty, , (- 50 )?

+1

, OP @Matt XML , Visual Studio ( ). , , , " " .

Open the report in Visual Studio BIDS as usual, then select "Report Data" from the "View" menu. If it is not there, click on the report canvas anywhere, then it should appear. In the appeared "Report Data" panel, you are interested in data sources (where is the data coming from?) And data sets (what are the queries, parameters, expressions?).

+1
source

Source: https://habr.com/ru/post/1771495/


All Articles