Greetings.
I have an RDLC file and am wanting to add a data source to it, although without any luck so far. The data source is a custom class written by myself (jus
There seems to be a bit of black magic going on here. Or at least I haven't figured out all of the incantation to make this happen reliably.
I think I was having a similar problem. Not sure if this will help you, but here's how I got around it.
In the VS2010 report designer, use view->Report Data to show the Report Data pane.
Click the New button and choose Dataset... to get the Dataset Properties dialog.
Name your Dataset, if you've done this before, you probably know that the dataset name here needs to match the name provided in code when you bind your ReportDataSource.
The new part that I just tried, is to click the New... button next to the Data source drop down list. The resulting wizard walks you through selecting your assembly and CLR class (use the checkbox to select your class).
When the wizard finished, my new dataset appeared.
One thing to note: The first time I tried to reproduce this, the wizard completed without adding my dataset. I went back to my class definition and decorated it with [DataContract] and [DataMember] attributes and then re-ran the wizard and it seemed to work great.
Perhaps someone with deeper knowledge can comment on why those attributes make this work, or why the wizard fails silently without them.
If added data source object is not shown on ReportData then: 1. Right click on rdlc and click open with 2. Select xml editor 3. add your needed dataset by hand.
After this refresh ReportData and you will see the datasource object on the list.
I have seen this happen when your final select in a Stored Procedure pulls from a temp/memory table. You have to fake the designer out by adding a dummy select 0 AS mycol1int, '' AS mycol2string, etc. Once you have created the Dataset, you can then remove that dummy select. Another marvelous, fabulous feature in VS! They own the DB, they own the IDE, but...
If you are using a stored procedure, replace everything inside the procedure with one row select using no source tables/functions. I couldn't get it working with a stored procedure that returned data from temp table or normal table either.
I could not add the datasource, after following the wizard (new button) the data source did not appear in the drop downlist. What I did was add a property with a primitive type VS class and then proceeded to show the correct data source.
Strange to have to do this, but I found another way.
Your data source object must include a native data type as a property on the class, otherwise it doesn't let you add it. Funny, eh!