How to add the data source to the rdlc file in visual studio 2010?

12,494

Adding datasets

First you have to add a Data Source in your Report. You can do this by using the Data Sources window in VS. Click the Add new data source and select what you want (I usually use object). In the Report Data window there is a folder 'Datasets'. If you right-click it you can add a dataset.

Data in a table

To visualize the dataset you can drag a Table from your Toolbox onto the report, select it, then right-click on the upper-left corner and select Tablix Properties. There you can bind a Dataset to the table. Choose which items you want to display in which column by clicking on the column and selecting a value.

Singular data (textbox)

You can set an expression on a textbox that retrieves a specific set of data from a dataset (you can also use this on table columns btw). You can do this by right-clicking the textbox en going to Expression. This will open up an Expression window that contains some sort of expression builder.

The expression I use to retrieve singular data is the following (not sure if this is the best approach but it's the only one I know):

First(Fields!MyField.Value, "MyDatasetName")

Basically I'm assuming there is only one row in my dataset (or that field is the same in all rows) so I'm just retrieving the first value.

Share:
12,494
Mohemmad K
Author by

Mohemmad K

Working as a trainee for ASP.Net with C#. I am a student of M.C.A.

Updated on June 04, 2022

Comments

  • Mohemmad K
    Mohemmad K almost 2 years

    I am new to windows desktop application development.

    I want to generate a bill report that is the bill master details should be displayed once and the related items should be displayed in the tabular format.

    I have created the data table in dataset. The data table is configured.

    Now in the report design I am not able to see this table to drag the field to their proper position.

    Please help how to do so.

    Thanks in advance.

  • Mohemmad K
    Mohemmad K about 11 years
    Thanks for reply sir.@Deruijter . Its working fine. I want to display the data in the text box placed in the report design.
  • Mohemmad K
    Mohemmad K about 11 years
    the Tablix Properties is available in the table only. How do I get that in the text box?
  • Deruijter
    Deruijter about 11 years
    I have updated the answer to explain how I personally display singular data. It's not very elegant but I have yet to find a better solution (the alternative is working with Parameters but I haven't had time to try that out yet)