Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Microsoft Report Viewer

reporting ssrs

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1 Sanjeewa

Sanjeewa

    CC Regular

  • Member
  • PipPipPip
  • 33 posts

Posted 29 November 2012 - 10:19 PM

I was trying to print a crystal report with crystal report view in VS2008 for custom paper size and failed .. I was wondering can do the same thing with success using SSRS facility (Reporting service in SQL server 2008 without crystal reports) with the help of Microsoft Report Viewer rather than crystal report viewer on VS 2008 , if so any good reference for a beginner in SSRS and Microsoft Report Viewer development would be very helpful.

#2 Sanjeewa

Sanjeewa

    CC Regular

  • Member
  • PipPipPip
  • 33 posts

Posted 29 November 2012 - 11:04 PM

This is for windows application issue ... so I LIKE to know good reference for a beginner in SSRS and Microsoft Report Viewer development
N.B . Just now got the news that Microsoft Report Viewer supports Crystal Report too , so any sample code or tute for Microsoft Report Viewer with Crystal Report is value to me.

thanks

#3 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 30 November 2012 - 07:49 AM

I understand sql server reporting is independent from crystal reports.
About Microsoft report viewer, i think this link might help you:
Report writer video tutorial (youtube)

#4 Barnsite

Barnsite

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 258 posts

Posted 30 November 2012 - 08:12 AM

Report Viewer is fairly easy to use.

I built a generic report viewer, which is a page with a report viewer on it, I then pass the report name that I want to show as a parameter in the url e.g.

	 protected void Page_Load(object sender, EventArgs e)
	 {
		 if (!string.IsNullOrEmpty(Request.QueryString["ReportName"].ToString()))
		 {
			 ReportViewer1.ServerReport.ReportPath = Request.QueryString["ReportName"].ToString();
			 addParameters();
		 }
	 }

I also send report parameters as key value pairs in the url, then iterate through the Request.QueryString.Keys to retrieve them and add to the report parameters.

	 private void addParameters()
	 {
		 ReportParameter[] reportParams = new ReportParameter[Request.QueryString.Keys.Count - 1];
		 int paramCount = 0;
		 foreach (string key in Request.QueryString.Keys)
		 {
			 if (key.ToString() != "ReportName")
			 {
				 reportParams[paramCount] = new ReportParameter(key.ToString(), Request.QueryString[key].ToString());
				 ReportViewer1.ServerReport.SetParameters(reportParams);
				 paramCount++;
			 }
		 }
	 }

this allows me to display any report + params from a single url.

E.g.

http://xx.xx.xx.xx/reportviewer/showreport.aspx?reportname=/OBP_Airline_Report&AirlineCode=BA

Report name = /OBP_Airline_Report
Parameter called AirlineCode gets the value "BA"
There are two ways to write error-free programs; only the third one works.




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download