[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

How to add and dispaly SQL Report in ASP.Net web application

I created  a sql report using SQL2008R2.I want to add the report to ASP.Net web application.How to add the report to web application and display it in report viewer.

Thanks
0
KavyaVS
Asked:
KavyaVS
  • 2
2 Solutions
 
TempDBACommented:
0
 
KavyaVSAuthor Commented:
I am not going to access the report from report server.I created a report and want to add it to the web application directly.

How to add the report to web application and display it

Thanks.
0
 
Alpesh PatelAssistant ConsultantCommented:
Place the report viewer on page and do as below:

ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings.Get("ReportServerUrl").ToString());
                ReportViewer1.ServerReport.ReportPath = Request.QueryString["RptPath"]; //@"/Reports/NetSurplus";


                IReportServerCredentials irsc = new CustomReportCredentials(ConfigurationManager.AppSettings.Get("ReportAdminUserName")
                    , ConfigurationManager.AppSettings.Get("ReportAdminPassword"), ConfigurationManager.AppSettings.Get("DomainName"));
                ReportViewer1.ServerReport.ReportServerCredentials = irsc;
                ReportViewer1.ServerReport.Refresh();
                                
                if (CurrentUser.RoleId == 3) //FPG Offices
                {
                    ReportParameter RptParam = new ReportParameter(ConfigurationManager.AppSettings.Get("ReportOfficeParam"), CurrentUser.OfficeName);
                    ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { RptParam });
                }
               
                ReportViewer1.ShowReportBody = true;
                ReportViewer1.ShowToolBar = true;
                ReportViewer1.ProcessingMode = ProcessingMode.Remote;
                ReportViewer1.AsyncRendering = false;
                ReportViewer1.SizeToReportContent = true;
                ReportViewer1.ShowParameterPrompts = true; 

Open in new window

0
 
KavyaVSAuthor Commented:
Thanks
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now