C# – Using report viewer, how to pull from two seperate Datasets

crdlcreportviewer

I have two datasets I need to pull from, A base that both reports use and then a separate one that only one report pulls from. I get the error

Error 12 The Value expression for the text box ‘Textbox9’ refers to
the field ‘Name’. Report item expressions can only refer to fields
within the current dataset scope or, if inside an aggregate, the
specified dataset scope.

My best guess is I have to associate them with the correct dataset but I have not been able to find any documentation on this.

edit: I am trying to access property files that I created for the fields on the report document.

Can someone please tell me where in the rdlc document I need to code something like name.value, "dataset1" or something similar?

Best Answer

When you create a table in a RLDC, in the Tablix properties (selecting a row or a column) you must associate a DataSet.

After doing that, you have to write in each cell the name of the field (in the dataset) that you will use. You can do that by clicking on the "little table" in the cell, when you put the mouse over it

In images (with Visual Studio 2010)

Tablix Properties

Selecting DataSet

Setting Field to Show

If you don't see the dataset in the list, you must add it. For that, click on view menu -> report data. Then, in the DummyDataSource, click Add Dataset..

Add new DummyDataSource

And select it from the list, or create a new one instead, in the same form. enter image description here

If this doesn't work, well I don't know haha

If the two datasets has the same structure, then you could use one just, and in the code assign it to the datasource

Related Topic