rendering reports

Discussion in 'ASP.NET WebServices' started by mike72, Mar 18, 2006.

  1. I have created a web reference to
    https://rs.discountasp.net/ReportServer/reportservice.asmx.
    Can you please explain to me what I need to do next in detail. Do I
    create an asmx file or a cs file to view reports? How do I link the
    file with the web reference? And what code do I need to use to do this? I have read the knowledgebase article and it doesn't make this clear.


    Thanks,

    Mike
     
  2. This is how far I've got, but I keep getting errors :





    private void Page_Load(object sender, System.EventArgs e)


    {


    ReportingService rs = new ReportingService();


    rs.Credentials = new System.Net.NetworkCredential("*****", "******", "");


    Byte[] results, image;


    string[] streamids;


    string streamid;


    //render the report to HTML 4.0


    results = rs.Render("/lovelyjubbly/reports/QBRatings", "HTML4.0", null, "<DeviceInfo><StreamRoot>/lovelyjubbly/</StreamRoot></DeviceInfo>", null, null, null, null, null, null, null, streamids);


    Response.BinaryWrite(results);














    }
     
  3. Bruce

    Bruce DiscountASP.NET Staff

  4. I get a number of errors :

    1) The best overloaded match has some invalid arguments
    2) Argument '8': cannot convert from '<null>' to 'out string'
    3) Argument '9': cannot convert from '<null>' to 'out string'
    4) Argument '10': cannot convert from '<null>' to 'out lovelyjubbly.net.discountasp.rs.ParameterValue[]'
    5) Argument '11': cannot convert from '<null>' to 'out lovelyjubbly.net.discountasp.rs.Warning[]'
    6) Argument '12': cannot convert from 'string[]' to 'out string[]'

    Please advise.

    Regards,

    Mike
     
  5. Bruce

    Bruce DiscountASP.NET Staff

  6. I am using ASP.NET 1.1.


    Regards,


    Mike
     
  7. Bruce

    Bruce DiscountASP.NET Staff

    this is really bizzare.

    I tested the code multiple times and it worked fine.

    The only thing I can think of is that you are using a different version of the reporting service dll than what i have./

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  8. Can you send me the DLL so that I can try it. I am using your code example and Visual Studio 2003, soit is strange thatit should bring up errors on building.


    Thanks,


    Mike
     
  9. Please advise. I need to get this part of my website up and running very soon, and as yet your sample code does not work.


    Regards,

    M Parr
     
  10. Bruce

    Bruce DiscountASP.NET Staff

  11. I am able to view reports in PDF format, however I still cannot view in HTML4.0. All I get on screen is an unviewable image, represented by a red cross.
    Here is my complete code :

    .cs

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using lovelyjubbly.net.discountasp.rs;

    namespace lovelyjubbly.Gameplan
    {
    /// <summary>
    /// Summary description for Reports.
    /// </summary>
    public class takeawaygiveawayratio : System.Web.UI.Page
    {
    private void Page_Load(object sender, System.EventArgs e)
    {
    ReportingService rs = new ReportingService();

    rs.Credentials = new System.Net.NetworkCredential('rs_58570', 'xxxxx', '');

    string reportPath = '/lovelyjubbl/reports/takeawaygiveaway';
    string format = 'HTML4.0';
    string historyID = null;
    string devInfo = @'<DeviceInfo><StreamRoot>/lovelyjubbly/</StreamRoot></DeviceInfo>';
    DataSourceCredentials[] credentials = null;
    string showHideToggle = null;
    string mimeType;
    string encoding;
    Warning[] warnings = null;
    ParameterValue[] reportHistoryParameters = null;
    Byte[] results = null;
    string[] streamIDs = null;

    //render the report to HTML 4.0
    results = rs.Render(reportPath,
    format,
    historyID,
    devInfo,
    null,
    credentials,
    showHideToggle,
    out encoding,
    out mimeType,
    out reportHistoryParameters,
    out warnings,
    out streamIDs);
    Response.BinaryWrite(results);
    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.Load += new System.EventHandler(this.Page_Load);
    }
    #endregion
    }
    }

    .aspx

    <%@ Page language='c#' Codebehind='takeawaygiveawayratio.aspx.cs' AutoEventWireup='false' Inherits='lovelyjubbly.Gameplan.takeawaygiveawayratio' %>
    <HTML>
    <HEAD>
    <title>takeawaygiveawayratio</title>
    </HEAD>

    <form id='Form1' method='post' runat='server'>
    </form>
    </body>
    </HTML>

    Please help me to solve this problem, otherwise I will have no alternative other than to cancel my SQL Reporting Services add on.


    Regards,

    M Parr

    Post Edited By Moderator (bruce [DASP]) : 4/3/2006 6:04:33 PM GMT
     
  12. Can you please send me the code that you said successfully rendered my reports as HTML during your tests, so that even if i can't get it to work locally, I can upload it to see if it works on the web server?





    Thanks,


    M Parr
     
  13. Bruce

    Bruce DiscountASP.NET Staff

    i edited your previous post to get rid of the password. please do not include login information in forum post.

    Certain type of report cannot be properly render using this method. Are you using anything special (like linked report) in your report?

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  14. Bruce

    Bruce DiscountASP.NET Staff

    oh.. the render method cannot render html images (ie. charts and stuff)

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  15. I'm not using anything special, I'm just doing the most basic of reports and trying to get these working before I move on to more complicated reports. Both my reports are bar charts coming from simple SELECT statements, passing no parameters. This is very frustrating as using PDF format works, but using HTML4.0 format does not work, so I am obviously on the right track, but there is something simple that I am not doing correctly or that is not set up at your endthat is preventing it from rendering in HTML.
     
  16. so how do i render as html? and if i can't render as html what formats can i render my reports as apart from pdf?
     
  17. Bruce

    Bruce DiscountASP.NET Staff

    basically when you render the page as html, the render method creates HTML that reference an .gif / jpeg file that exist.

    render method only work with text report (as far as I know).

    Are you familiar with ASP.NET 2.0? It has a built in Report Viewer control. see the hot post posting for article.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  18. Can you use ASP.NET 2.0 with SQL Server Reporting Services 2000 and still get all the advantages of it over ASP.NET 1.1?
     
  19. Bruce

    Bruce DiscountASP.NET Staff

Share This Page