locked
Reuse DataSet in Report multiple times with different parameters RRS feed

  • Question

  • Hi there,

    I have an RDLC report containing two tables. Each table is filled by content retrieved from a dataset with a SQL query.

    The SQL queries for each table do only differ in one part of the WHERE clause. 

    Currently I have defined separate datasets for each table. 

    I didn't find a way to create a single dataset which can be reused in every table by passing a certain parameter to the dataset. Is this somehow possible?

    Regards

    Monday, November 26, 2018 7:20 AM

Answers

  • Hi Abid P. Hussain

    According to your description, there is no built-in features to pass different parameter to dataset query .

    So , it would not use the dynamic condition in dataset query by default.

    You need to pass the condition parameter in code to achieve your goal :

    Below is the detailed process:

    RDLC Report with parameters (C# Code)

    Lesson 8: Create a Data Filter

    You could try it and check if it works.

    Best Regards,

    Eric Liu


    Best Regards, Eric Liu MSDN Community Support Please remember to click Mark as Answer if 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.

    Tuesday, November 27, 2018 9:26 AM

All replies

  • Hi Abid P. Hussain

    According to your description, there is no built-in features to pass different parameter to dataset query .

    So , it would not use the dynamic condition in dataset query by default.

    You need to pass the condition parameter in code to achieve your goal :

    Below is the detailed process:

    RDLC Report with parameters (C# Code)

    Lesson 8: Create a Data Filter

    You could try it and check if it works.

    Best Regards,

    Eric Liu


    Best Regards, Eric Liu MSDN Community Support Please remember to click Mark as Answer if 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.

    Tuesday, November 27, 2018 9:26 AM
  • Thanks.

    What makes me wonder is that there does not seem to be any functionality to pass a report parameter directly to a dataset (to be used as parameter for the dataset). It seems that report parameters can only be used to be displayed in the report or in a filter.

    Tuesday, November 27, 2018 9:52 AM