Click here to Skip to main content
15,900,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All

I am using rdlc reports in my project. It was working fine.
But I am using sub report and it is working fine on my local server. But giving error on server.
ASM
An error has occurred during report processing.
    Exception has been thrown by the target of an invocation.
        A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)


My sub report don't contain any parameter and i am using following code to find subreport for report viewer
C#
protected void Page_Load(object sender, EventArgs e)
   {
       this.ReportViewer1.LocalReport.EnableExternalImages = true;
       ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource);
       this.ReportViewer1.LocalReport.Refresh();
   }
   public void SetSubDataSource(object sender, SubreportProcessingEventArgs e)
   {
       e.DataSources.Add(new ReportDataSource("TermsDataSet_TERMS", "ObjectDataSource3"));
   }



Can anyone please suggest me where the bug is?

Thanks in advance
Posted

1 solution

Data for the subreport is not supplied properly.
The connection with SQL may have issues and that's what seems to be the reason here. Verify these two settings:

1- Check the reportdatasource object is configured properly (connection string etc..)
2- The datasource of the subreport is pointing to the right datasource.

Hope it helps...
 
Share this answer
 

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