Answered by:
Manual binding example

Question
-
I have a lot of RDL reports that I would prefer not to convert to RDLC. www.gotreportviewer.com mentioned manually binding data sources to these reports, but I could not find an example of how to do this. Does anyone have an example of this?
Thursday, February 16, 2006 12:23 AM
Answers
-
This will only work if the RDL is 2005 version. Rename the .rdl to .rdlc and add it to the project. Using the smart tags panel of ReportViewer select the rdlc file. (Notice that the DataSet, BindingSource and TableAdapter objects are NOT automatically created at this point, unlike in the case of an .rdlc that originated as an .rdlc.) From the smart tags panel, select the Choose Data Sources command. A dialog opens. In this dialog, a list of datasources expected by the report are seen in the left column of a grid. Click on the right column of the grid to get a UI for instantiating a project data source. If you don't have corresponding project data sources you can define new data sources right from this dialog, as long as you know the SQL that was used in the original RDL file. (If you don't, look in the original RDL file by opening it in Notepad.)
Note that unlike when you are running the RDL on a report server, ReportViewer does not prompt you for credentials or parameters, and you have to handle subreports and drillthrough events to supply data. It will be less work for you to leave the RDLs on the server and take advantage of the remote mode of ReportViewer.- Marked as answer by Keith Walton Friday, July 18, 2008 5:58 PM
Thursday, February 16, 2006 5:51 PM
All replies
-
This will only work if the RDL is 2005 version. Rename the .rdl to .rdlc and add it to the project. Using the smart tags panel of ReportViewer select the rdlc file. (Notice that the DataSet, BindingSource and TableAdapter objects are NOT automatically created at this point, unlike in the case of an .rdlc that originated as an .rdlc.) From the smart tags panel, select the Choose Data Sources command. A dialog opens. In this dialog, a list of datasources expected by the report are seen in the left column of a grid. Click on the right column of the grid to get a UI for instantiating a project data source. If you don't have corresponding project data sources you can define new data sources right from this dialog, as long as you know the SQL that was used in the original RDL file. (If you don't, look in the original RDL file by opening it in Notepad.)
Note that unlike when you are running the RDL on a report server, ReportViewer does not prompt you for credentials or parameters, and you have to handle subreports and drillthrough events to supply data. It will be less work for you to leave the RDLs on the server and take advantage of the remote mode of ReportViewer.- Marked as answer by Keith Walton Friday, July 18, 2008 5:58 PM
Thursday, February 16, 2006 5:51 PM -
Does this mean we can't programatically render the RDL file ? .. unless RDL is programatically metamorphosed into RDLC and then fed to ReportViewer Control ????Thursday, February 1, 2007 10:29 PM
-
At runtime ReportViewer control can't tell an RDL file from an RDLC file. The extra information in RDLC files is relevant at design-time only.Friday, February 2, 2007 12:35 AM
-
I am sorry, it is still fuzzy. From your post I believe the RDL doesn't have that extra information that comes with RDLC. So my question would be
1. Would that make a difference when you feed RDL to a ReportViewer Control at run time ?
2. If it does, how would you achieve the same results programatically ?
I have a bunch of RDL and corresponding XML files (which is datasource). I want my users to select an RDL at run time and render the report, and based on the RDL the App pulls the data from the relevant XML file. Is all this possible programatically ?
I would really appreciate if any one could help me out..Tuesday, February 13, 2007 1:04 AM -
This is the error I am getting ..
A data source instance has not been supplied for the data source '--name--'. What should be done here and can it be done programatically ?- Proposed as answer by Paul TurleyMVP Wednesday, August 25, 2010 7:11 PM
Tuesday, February 13, 2007 2:25 PM -
Is this the only way to convert and can this be done programatically ?
RDL-to-RDLC Conversion
When converting a .rdl file to .rdlc format, you must manually replace the data source and query information in the report definition with data constructs provided in your application.
-
Rename the .rdl file to use the .rdlc file extension.
-
In Visual Studio 2005, open the solution or project that will contain the report.
-
Create or add the dataset that defines the data you want to use to your projector solution. For more information, see Creating Data Sources for a ReportViewer Report.
-
On the Project menu, click Add Existing Item and then select the .rdlc file that you created in the first step.
-
In the project, open the form or Web page that will contain the report.
-
From the Toolbox, in the Data group, drag a ReportViewer control onto the form or Web page.
-
In the ReportViewer Tasks smart tags panel, in Choose Reports, select the .rdlc file to use with the control.
-
In the ReportViewer Tasks smart tags panel, in Choose Data Sources, select the dataset you want to use. The dataset object, binding source object, and table object will appear at the bottom of the workspace. For more information about updating data source references, see Updating and Rebinding Data Source References.
-
Save all files, and then build or deploy the project to verify that the report contains the data you expect.
Tuesday, February 13, 2007 6:00 PM -
-
I once did this in .Net by using ReportDefinition.xsd and Altova XmlSpy to generate a RDL library
Then all you do is
Code Snippetpublic System.IO.Stream GetRDLCReportDefinition(string rdlFilename)
{
ReportDefinition.
ReportDefinitionDoc document = new ReportDefinition.ReportDefinitionDoc();ReportDefinition.
ReportType root = new ReportDefinition.ReportType(document.Load(rdlFilename)); for (int i = 0; i < root.GetDataSetsCount(); i++){
ReportDefinition.
{
ReportDefinition.
{
ReportDefinition.
{
query.RemoveQueryParametersAt(p);
}
}
}
}
{
root.RemoveReportParametersAt(rp);
}
System.Text.
UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] buffer = encoding.GetBytes(document.SaveToString(root)); return new MemoryStream(buffer);}
Thursday, June 28, 2007 4:48 AM -
But how can I use parameters which I designed in ReportingServices ?
I try to use these parameters but it didn't work.. Is there a programatic way to set parameters ?
I need to use for example parameter Date, which I would like to be a DropdownList in a Report and it should get data from SELECT distinct some_date from my_tableFriday, October 3, 2008 2:48 PM