The current source code create a dataset to feed report in codebehind with obsolete, unsafe and pretty error prone code. I would like to switch to databound components and possibily use
SQLDataSource instead (using a more up-to-date paradigm like Entities will require too much work at this time).
Proceding on my job I'm facing a lot of strange errors most of which are given to my superficial knowledge of
ReportViewer and/or MS reports in general.
The first issue follows any attempt to edit the report trough Visual Studio embeeded report designer... it need to replace
xmlns entry described above with an updated one but this triggers the following error:
The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition' which cannot be upgraded.
Using VS report editor is not mandatory but it will speed up the upgrade process and anyway I don't understand why an outdated 2008
reportdefinition should be more acceptable than newer ones.
The second issue relates to the report .rdlc file loading: It seems that the only way to correctly locate the report file is to specificy its absolute path in
ReportPath property... unluckly this's only possibile on local test machine but not on the server.
For some reason this correctly locates the report in the current folder (same of the form running the report) but prevent report from being previewed at design time in
VisualStudio.
Is possibile to fix this trough .ASPX code?
The last question is related to SQLDataSource databinding. It seems that's possibile to bind report to such kind of data-source. I found a number of example of people doing so and using just something like this between
LocalReport tags:
but what's the correct workflow to make this? (from the the implant of the report in the form to datasource field mapping)
I tried to make a report form from scratch trough Visual Studio project templates but it seems to rely on
.xtd files that I would like to avoid if possible.
---- UPDATE ----
If I try to add a new ReportViewer tag to an empty form I got this (inside
Visual Studio preview):
Error creating control - rptData to create designer 'Microsoft.Reporting.WebForms.ReportViewer, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I googled the error code and found that this should be related to the current version of nuget packages:
the only (negative) change is a compilation time error:
Error CS0234 type or namespace 'Reporting' does not exist in namespace 'Microsoft'....
What's the correct set of packages / references to be used to make report works?
---- UPDATE 2 ----
This mix of packages seems to allow report preview (at least with reports created from scratch) and run without errors. The only negative sideffect is the need of
.xtd files instead SQLDataSources:
What's the correct set of packages / references to be used to make report works?
I'm not sure how you did it. If you need to add dependencies, you could try this:
Right click on References under the project
select Add Reference...
select Assemblies
select Extensions
find Microsoft.ReportViewer.WebForms
Click ok to apply
Something like this:
Hope this can help.
Best regards,
Xudong Peng
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
I was sure this reference was already present in my project but I did fail..
I mean.. the reference is present but it's not listed between Extensions.
It's a normal behaviour? I mean .. the referenced assemblies are removed from available extensions list ?
I'm not sure how you did it to get this result. Did you download the "ReportViewer.WebForms.dll" assembly directly and put it directly in the project directory?
If this is the case, you could select it from broswe, the premise is that you need to accurately find the location where the assembly is stored in the machine.
Best regards,
Xudong Peng
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Member
2 Points
24 Posts
Using ReportViewer with SQLDataSource and MySQL
Mar 30, 2021 12:23 PM|weirdgyn1972|LINK
Hallo,
I've been asked to upgrade some asp.net form associated with a report running on IIS with MySQL database.
Such .rdlc reports have been created with an older release of MS ReportDesigner. I found this reference inside .rdlc files:
I need to make some major modification to several forms running reports trough tags like this:
The current source code create a dataset to feed report in codebehind with obsolete, unsafe and pretty error prone code. I would like to switch to databound components and possibily use SQLDataSource instead (using a more up-to-date paradigm like Entities will require too much work at this time).
Proceding on my job I'm facing a lot of strange errors most of which are given to my superficial knowledge of ReportViewer and/or MS reports in general.
The first issue follows any attempt to edit the report trough Visual Studio embeeded report designer... it need to replace xmlns entry described above with an updated one but this triggers the following error:
Using VS report editor is not mandatory but it will speed up the upgrade process and anyway I don't understand why an outdated 2008 reportdefinition should be more acceptable than newer ones.
The second issue relates to the report .rdlc file loading: It seems that the only way to correctly locate the report file is to specificy its absolute path in ReportPath property... unluckly this's only possibile on local test machine but not on the server.
I fixed this trough codebehind using:
For some reason this correctly locates the report in the current folder (same of the form running the report) but prevent report from being previewed at design time in VisualStudio.
Is possibile to fix this trough .ASPX code?
The last question is related to SQLDataSource databinding. It seems that's possibile to bind report to such kind of data-source. I found a number of example of people doing so and using just something like this between LocalReport tags:
but what's the correct workflow to make this? (from the the implant of the report in the form to datasource field mapping)
I tried to make a report form from scratch trough Visual Studio project templates but it seems to rely on .xtd files that I would like to avoid if possible.
---- UPDATE ----
If I try to add a new ReportViewer tag to an empty form I got this (inside Visual Studio preview):
I googled the error code and found that this should be related to the current version of nuget packages:
used by my site solution. But trying to find a working one like this:
the only (negative) change is a compilation time error:
What's the correct set of packages / references to be used to make report works?
---- UPDATE 2 ----
This mix of packages seems to allow report preview (at least with reports created from scratch) and run without errors. The only negative sideffect is the need of .xtd files instead SQLDataSources:
Best regards,
Mike
Contributor
2390 Points
743 Posts
Re: Using ReportViewer with SQLDataSource and MySQL
Mar 31, 2021 05:48 AM|XuDong Peng|LINK
Hi weirdgyn1972,
I'm not sure how you did it. If you need to add dependencies, you could try this:
Something like this:
Hope this can help.
Best regards,
Xudong Peng
Member
2 Points
24 Posts
Re: Using ReportViewer with SQLDataSource and MySQL
Mar 31, 2021 08:59 AM|weirdgyn1972|LINK
I was sure this reference was already present in my project but I did fail..
I mean.. the reference is present but it's not listed between Extensions.
It's a normal behaviour? I mean .. the referenced assemblies are removed from available extensions list ?
Contributor
2390 Points
743 Posts
Re: Using ReportViewer with SQLDataSource and MySQL
Apr 01, 2021 08:44 AM|XuDong Peng|LINK
Hi weirdgyn1972,
I'm not sure how you did it to get this result. Did you download the "ReportViewer.WebForms.dll" assembly directly and put it directly in the project directory?
If this is the case, you could select it from broswe, the premise is that you need to accurately find the location where the assembly is stored in the machine.
Best regards,
Xudong Peng