开发者

How do I add a column to an rdlc's dataset and have it appear for use in the report?

I have an rdlc that has a separately-defined dataset. The time has come that I have the need to add a colu开发者_StackOverflow中文版mn to one of the tables, which I can do without issue. However, when I open the rdlc to use the new column, it does not appear in the Report Data pane.

This issue was reported to Microsoft here, but it was closed as by design. The workaround offered with the issue does not seem to work for VS2010 (refresh the dataset or the table; neither does anything).

Has anyone seen this problem, and if so, how did you get around it?


Well, I resolved my problem, but I don't like how I had to do it.

For reference, (as far as I can tell) the only way to add a column to a dataset that is already attached to an rdlc is to hand-edit the xml (i.e. open the rdlc with your favorite text editor and add a Field to the appropriate table). After doing this, the field appears in the Report Data pane, and I can use it as if it were there from the beginning.

I would still like to know how to perform this seemingly simple task from the UI, but nonetheless my current problem is solved.


For those people who googled and got here, the Report Data panel is often hidden and can be found in the menu under View -> Report Data (Ctrl + Alt +D)... it's right at the bottom: http://www.codeease.com/about-update-dataset-for-a-rdlc-file-in-visual-studio-2010.html

Once that's up you can right click on the report data sets and refresh or edit them. This has always worked for me (once I remember and find the Report Data panel!), so I'm not sure why it didn't work for the OP.


Quick workaround I found for VS 13 users (not tested in other versions):

  1. Make the change you want in your class (add/remove/rename properties)
  2. Build the project
  3. Unload the report project
  4. Reload the report project
  5. Open the report rdlc file
  6. Make sure your Report Data window is visible, if not find it hidden at the bottom in the view menu
  7. Right click your data set and click 'Refresh', it will now work


I'm using VS 2010.

On Solution Explorer

  1. Double click the .xsd file where your rdlc report is connected.
  2. Right Click > Configure
  3. Click Query Builder > Check/Select the fields you needed.
  4. Next > Next > Finish then Save.

On RDLC Report

  1. Press CTRL + ALT + D.
  2. On Report Data, right click DataSet then Refresh.


This is for VS 2010.

Watch out for menu "Data" in Slandered menu.

Data --> Show Data Sources

You will get options to refresh the RDLC Data Source and all options related.


The easiest way I found is, if somebody out there is still looking for an answer, add a new Data Source (the xsd), on Report Data pane==>right click on Datasets ==>Add Dataset, the Dataset Properties dialog will appear. Create a new dataset, this time it will populate all the columns from table/stored proc. Once the dataset is added, exclude the old dataset, rename it to something else, through windows explorer or command prompt. Now exclude the newly added dataset, rename it to the old dataset name and include it back to the project. The data gets refreshed.


I am using VS 2008. THere's no View | Report Data in the menu. So, I hacked the RDLC file using NotePad. Some sections are binary, but some sections are xml. One of the xml sections lists the datafields. I just added one at the bottom of the list and changed the name and datatype as appropriate. I referenced the Dataset in my VS project so I got the right datatype and name. All works fine now.


Open file rdlc in Visual Studio, then click View (in top menu) --> Data Report, in panel Data Report,right click into Data Sources/Report Dataset then click refresh.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜