visual studio 2010: creating an rdlc report with a dataset as the datasource in a website RRS feed

  • Question

  • User1401018488 posted


    I have a website with a report viewer. I need to set the report of this report viewer to an rdlc report. I have also created a dataset to generate the report from. My problem is that the data I need to use to generate the report from is data from a dataset and NOT data from an sql database. How can I do this? When I set the report to the report viewer using the smart tags, I get an ObjectDataSource. Now, when I open the report viewer smart tag and select choose datasource, in the datasource options, I only get ObjectDataSource but I do not get the dataset I want! When I open the smart tag of the ObjectDataSource, a wizard opens in which I need to enter a connection string (I can not use connection strings because i need the data from a dataset not a database). My dataset is populated by code and not through the datatableadapter which I believe is the cause of the problem since I can only bind the ObjectDataSource to datatableadapters which don't exist in my case. What can I do in this case? Can't you generate a report from data within the project? Should the data be from an external database? I don't understand the ObjectDataSource and how can I link it to a dataset in the project! Sorry for some questions if they are simple but this is the first time I use reportviewer in a website. Any help much appreciated.


    Saturday, October 15, 2011 4:03 AM

All replies

  • User-1488931086 posted


    You should try to create a class with a select method, and then drag and drop an ObjectDataSource to bind to this select method. And then Bind the ObjectDataSource to the ReportViewer.

    PS: Part of this problem may be related to ReportViewer, you can refer to ReportViewer here.

    Sunday, October 16, 2011 9:31 PM
  • User1401018488 posted

    Hi TimoYang,

    Thanks for the help. Much appreciated! Can you please give me some more details about how to create the class? What structure should the class have? How can the ObjectDataSource identify the select method? Should the select method have a specific name to be identified? What should the return type of the select method be? I would appreciate it if you guide me through these questions or provide a link that answers them as I wasn't able to find one!

    Thanks again,

    Monday, October 17, 2011 1:25 AM
  • User1401018488 posted

    I think what you mean is listed here http://www.gotreportviewer.com/objectdatasources/index.html 

    I followed the tutorial in this link and everything works fine but when the report opens, it is empty! No data appears in the columns. What is wrong? Any help much appreciated. Thanks


    Monday, October 17, 2011 5:03 AM