Search code examples
c#asp.netreport-viewer2010

When using Report Viewer and asked for datasource my data access class does not show up


I am new to using the report viewer control.

The way I am currently creating a report is by calling a stored procedure and inserting input parameters to query a table in a database and to return a list of rows.

The rows are inserted into a Data Table and the Data Table is returned.

The data table is binded to a gridview which the user can view.

Now my problem....

I would like to use the report viewer to display the data instead of the gridview so the users can easily export the data and view a nice graph with it.

The Stored Procedure is called from my data access class which is just a class I have in my project (it is not in a folder).

When I go to create a report viewer and get asked for my datasource my data access class does not show up. How can I get the results (the returned data table) from my stored procedure function to get inserted into the report viewer?


Solution

  • What I ended up doing to get the report viewer to access my datatable was add a dataset to my project. Within that dataset I had to create a datatable with the same column names as in my code generated data table. From there I went to my report and added a table and pointed it towards the datatable which was created within the dataset. Then in my code I programmatically added the datatable using the code described above from Shelby.