From: cpnet on
I'm using VS2005, C#, ASP.NET 2.0. I'm trying to create a report using SQL
Reporting Services (to be used in local mode so I don't have to deal with
SQL Server). When I create a new report in my website, nothing shows up in
the Website Data Sources window. I added a few different strongly-typed
Datasets to my website, and they don't show up. The only way I could get
anything to show up was to create a new class that's derived from a
strongly-typed Dataset I created in a separate assembly. Once I did that,
this parent Dataset (from the external assembly) was listed as a Website
Data Source (but not the derived class?). And, all of the sudden all of the
strongly-typed Datasets I created in my website also showed up. The
DataTables from the Dataset defined in my external assembly do not seem to
import into the Website Data Sources properly either. All DataTables are
listed once, with the exception of the first DataTable, which is listed
again with the name of the DataSet prepended to the DataTable's name. If I
delete the class (in my website) that I derived from the Dataset (in the
external assembly), then all of the strongly-typed Datasets I defined in my
Website project disappear from the Website Data Sources, as does the dataset
defined in the external assembly. I must be missing something, or there's a
bug of some sort.

Here's what I want to be able to do: Build a report based on a Dataset that
I've defined in a separate assembly from my website (i.e. my business logic
layer). I will populate this Dataset manually without using any database.
I don't think I should have to derive a class in my website (which I'll
never actually use) from the dataset defined in my separate assembly, just
to be able to use the Dataset defined in that separate assembly as a report
data source for my website.


From: user on
I sure feel your pain about Data Sources being extremely flakey. Im
using business objects, and maybe 20% of the time they show. Much more
often I have to close the solution, re-open it, bring up a report and
hope the objects are there. The one strongly typed dataset a test
report uses normally shows. The objects are exposed as a generic list,
which is what MS shows on the msdn site in their samples
Arrggghhhhh. Never had this nonsense with the crystal reportviewer.

cpnet wrote:
> I'm using VS2005, C#, ASP.NET 2.0. I'm trying to create a report using SQL
> Reporting Services (to be used in local mode so I don't have to deal with
> SQL Server). When I create a new report in my website, nothing shows up in
> the Website Data Sources window. I added a few different strongly-typed
> Datasets to my website, and they don't show up. The only way I could get
> anything to show up was to create a new class that's derived from a
> strongly-typed Dataset I created in a separate assembly. Once I did that,
> this parent Dataset (from the external assembly) was listed as a Website
> Data Source (but not the derived class?). And, all of the sudden all of the
> strongly-typed Datasets I created in my website also showed up. The
> DataTables from the Dataset defined in my external assembly do not seem to
> import into the Website Data Sources properly either. All DataTables are
> listed once, with the exception of the first DataTable, which is listed
> again with the name of the DataSet prepended to the DataTable's name. If I
> delete the class (in my website) that I derived from the Dataset (in the
> external assembly), then all of the strongly-typed Datasets I defined in my
> Website project disappear from the Website Data Sources, as does the dataset
> defined in the external assembly. I must be missing something, or there's a
> bug of some sort.
>
> Here's what I want to be able to do: Build a report based on a Dataset that
> I've defined in a separate assembly from my website (i.e. my business logic
> layer). I will populate this Dataset manually without using any database.
> I don't think I should have to derive a class in my website (which I'll
> never actually use) from the dataset defined in my separate assembly, just
> to be able to use the Dataset defined in that separate assembly as a report
> data source for my website.
>
>
From: Steven Cheng[MSFT] on
Hello cpnet,

As for the Datasource for local report(RDLC) of webform reportviewer
control, it will list those DataSet or custom business classes defined in
the web project itself or in any referenced assembly or projects. Is your
separate class library project referenced through project reference or
direct dll reference? You can try removing it and adding reference against
it again to see whether it works. Here is the MSDN walkthrough on
displaying local report with custom business class in webform reportviewer:

http://msdn2.microsoft.com/en-us/library/ms251692(VS.80).aspx

For your scenario, if you want to supply the datasource for
reportviewr(localreport) without querying database(or use DataSource
control), you can do it programmatically as below:

==========aspx template==================
<div>
<rsweb:ReportViewer ID="ReportViewer1" runat="server"
Font-Names="Verdana" Font-Size="8pt"
Height="400px" Width="400px">
<LocalReport
ReportPath="c:\inetpub\wwwroot\ASPNET\V2\WebSites\UrlCopySite\reports\simple
report.rdlc">
<DataSources>

</DataSources>
</LocalReport>
</rsweb:ReportViewer>

..........................

========code behind=======================
protected void Page_Load(object sender, EventArgs e)
{

UrlCopySiteLib.ProductDS.ProductsDataTable products = new
UrlCopySiteLib.ProductDS.ProductsDataTable();
products.AddProductsRow("product1", 1, 1);
products.AddProductsRow("product2", 2, 2);
products.AddProductsRow("product3", 3, 3);
products.AddProductsRow("product4", 4, 4);

ReportDataSource rds = new ReportDataSource("Products", products);

ReportViewer1.LocalReport.DataSources.Add(rds);

}

==================================

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.

From: cpnet on
> As for the Datasource for local report(RDLC) of webform reportviewer
> control, it will list those DataSet or custom business classes defined in
> the web project itself or in any referenced assembly or projects. Is your
> separate class library project referenced through project reference or
> direct dll reference? You can try removing it and adding reference against
> it again to see whether it works. Here is the MSDN walkthrough on
> displaying local report with custom business class in webform
> reportviewer:
>

Unfortunately VS doesn't seem to behave like you're describing below.
Here's my situation:

- I have defined 3 DataSets in my web project (dsTest1, dsTest2, dsTest2)
- I have defined a 4th DataSet (dsTest4) in OtherAssembly.dll. Some classes
in my web project use this dsTest4 DataSet
- I have added a reference to OtherAssembly.dll in my web project
(right-clicked on my web project, and selected "Add Reference...", then
selected the assembly from the "Projects" tab of the Add Reference dialog)

When I do all of the above, NOTHING shows up in the Website Datasources
window. I have tried adding and removing the reference to OtherAssembly.dll
a couple of times, and this has not helped. OtherAssembly.dll is part of
the same solution as my web project.

Next, what I tried is:
- create a new class (dsTest4Descendent) in my web project that is derived
from dsTest4 (from OtherAssembly.dll)

When I do this, I see the following available as datasources:
- dsTest1
- dsTest2
- dsTest3
- dsTest4
- I do NOT see dsTest4Descendent listed.

As soon as I remove the dsTest4Descendent class from my web project, ALL of
the available Website Datasources disappear.

My web project also has a few helper classes that return strongly-typed
DataSets/DataTables as either public properties or methods, and none of
these show up as Website Datasources ever.


From: Steven Cheng[MSFT] on
Thanks for your reply cpnet,

It seems the problem you met is specific to some particular things, and so
far my local tests behaves a bit different from you. I've performed some
research over the net and did found some other members suffer the similar
issue. Is this the only project you've suffered on the problem?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.