Calling Reporting services objects from .NET

  • Hey Dudes,

    i need Reporting Services objects to be pulled from .Net. Bascially the intension is without using the report manager interface i need to access those objects using .NET .Let me know if u have a code related to it .

  • You can use the .Net ReportViewer Control for this.

  • Hey dude,

    can u send me any code,material related : To manage Report manager objects using .net .

    Thanks in advance ...

  • a bit old but i thought i'd reply nonetheless.

    You have a control in .net called the report viewer.

    It's honestly as simple as dragging the control onto your form and specifying your reportserver and report. thats it... no database connections, nada. Just magically works. 😉

  • Follow following steps:

    1. Add reference to local web service i.e. ReportExecution2005

    2. While adding Web reference give Web reference Name as RSWebReference

    3. Add one ASPX page with C# or .vb

    4. Add following line to your code

    using RSWebReference;

    5.Add following code to your buttton click

    protected void Button1_Click(object sender, EventArgs e)

    {

    // Prepare Render arguments

    string historyID = null;

    string deviceInfo = null;

    string format = "PDF";

    Byte[] results;

    string encoding = String.Empty;

    string mimeType = String.Empty;

    string extension = String.Empty;

    RSWebReference.Warning[] warnings = null;

    string[] streamIDs = null;

    RSWebReference.ReportExecutionService rsExec = new RSWebReference.ReportExecutionService();

    rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;

    //rsExec.Credentials = new NetworkCredential(username, password, domain);

    RSWebReference.ExecutionInfo ei = rsExec.LoadReport("/reportname", historyID);

    RSWebReference.ParameterValue[] rptParameters = new RSWebReference.ParameterValue[1];

    //rptParameters[0] = new RSWebReference.ParameterValue();

    //rptParameters[0].Name = "ReportMemo";

    //rptParameters[0].Value = RptMemo;

    ////render the PDF

    //rsExec.SetExecutionParameters(rptParameters, "en-us");

    results = rsExec.Render(format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);

    Response.AddHeader("content-disposition", "attachment; filename=Report.pdf");

    Response.OutputStream.Write(results, 0, results.Length);

    //This is very important if you want to directly download from stream instead of file

    Response.End();

    }

    6. I'm assuming your report is deployed on report server

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply