Click here to Skip to main content
15,068,157 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a project that designed. by c #. Net-ASP.NET .I have used the
Microsoft Report "ReportViewer control"
my problem:when publis project to iis and run the report with "ReportViewer"
the message appeard :"Main Report Canot be fund"
1 - is neded "Sql Report Service" for run ReportViewer is IIS?
2 - I installed Report Service is the active , but I did not solve the problem.
3 - Please tell me an example or more settings

If you are not using the Server part of reporting services then you are using a "local" report, the report file must have an.rdlc extension rather than a .rdl

When using local reports it is up to you to supply all the report data from your code. Design and test the report, make careful not of the data source names as you will need to callyou data sources the exact same name. I use the following code to populate an asp reportviewer.

/// <summary>
/// Put the data and the rdlc file together and give it to the report viewer
/// </summary>
/// <param name="dtData">datatable from the stored procedure used to supply the data</param>
/// <param name="sDataSetName">name of the datasource used in the rdlc</param>
/// <param name="sReportFile">full path of the rdlc file</param>
private void DoStdReport(DataTable dtData, string sDataSetName, string sReportFile)
	DataSet oDS = dtData.DataSet;
	oDS.DataSetName = sDataSetName;
	string sPath = Server.MapPath("");
	string sFile = System.IO.Path.Combine(sPath, sReportFile);
	TextReader oTR = File.OpenText(sFile);
	ReportDataSource oRepDS = new ReportDataSource(sDataSetName, oDS.Tables[0]);
	string s = RepView.LocalReport.DataSources[0].Name;
My problem is not solved yet
please help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900