?
Solved

How to use dataset of .rdl file in web application (asp.net) after converting it to .rdlc visual studio 2008 C# and SSRS 2008 R2

Posted on 2011-09-12
5
Medium Priority
?
1,769 Views
Last Modified: 2013-11-26



Hi,

I have a situation where I need to use a report which was created initially in SSRS 2008 R2 and has .rdl extension. Now, I want to use this report on asp.net (C#) page.
I have added this report in web application package and changed it's extension to .rdlc and droped reportviewer control on design area and assigned imported .rdlc file to it.
Can you please tell me how to use the existing datasets of the report file. As I could not find any option to use the data source already present in the report.
In the meanwhile if go to report's code in xml view I can see all sql statements which are being used in the dataset!!!!!!!!!!


Your comments and suggestions are highly appreciated.

Thanks.
0
Comment
Question by:ezkhan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 9

Assisted Solution

by:mimran18
mimran18 earned 1000 total points
ID: 36527519
Hi,
     Try this.But you donot need to do step 1 and Step 2 because you have already included file in project.
You also need to change names in this code
           <LocalReport ReportPath="Report.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData"
            TypeName="testreportDataSetTableAdapters.Get_Address_spTableAdapter"></asp:ObjectDataSource>

Reference : http://www.c-sharpcorner.com/UploadFile/jayendra/7738/
0
 
LVL 9

Expert Comment

by:mimran18
ID: 36527522
0
 
LVL 27

Accepted Solution

by:
planocz earned 1000 total points
ID: 36557712
Rdl and Rdlc are used the same way. There is nothing to chnce in the dataset.
I do not know if this will help you using VB.net  but this is the kind of code we use on the web site side to view a rdl report in a PDF format. Can be used in 2005 or 2008
Imports System
Imports System.IO
Imports System.Data
Imports System.Web.Services.Protocols
Imports Microsoft.SqlServer.ReportingServices2005.Execution

Partial Class RdlViewer
    Inherits System.Web.UI.Page
    Private ReportName As String = "MyReportName"
    Private DirPath As String = "MyDirectory"
    'Private objParameters(25) As Microsoft.Reporting.WebForms.ReportParameter
    Private pdfParameters(25) As ParameterValue

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Response.Buffer = True
        Response.Expires = -1442
        Response.AddHeader("cache-control", "private")
        Response.AddHeader("pragma", "no-cache")

        If Not Page.IsPostBack Then
            Dim ServerUri As New Uri(System.Configuration.ConfigurationManager.AppSettings("ReportServerURL"))
            ReportViewer1.ServerReport.ReportServerUrl = ServerUri
            ReportViewer1.ServerReport.ReportPath = "/ServerReports/" & DirPath & "/" & ReportName

            'Go get the report parameters
            PDFParams()

            'Go run the report viewer in PDF Screen
            asPDF()


        End If
    End Sub

    Sub PDFParams()

 'Test Parameters that you setup or add to your code
        pdfParameters(0) = New ParameterValue    'SQL2008.ParameterValue
        pdfParameters(0).Name = "CustomerID"
        pdfParameters(0).Value = "10000"    'Session("ProspectID")
        pdfParameters(1) = New ParameterValue    'SQL2008.ParameterValue
        pdfParameters(1).Name = "ProductID"
        pdfParameters(1).Value = "2000"   
        pdfParameters(2) = New ParameterValue    'SQL2008.ParameterValue
        pdfParameters(2).Name = "CustomerName"
        pdfParameters(2).Value = "John Doe"            pdfParameters(3) = New ParameterValue    'SQL2008.ParameterValue
        pdfParameters(3).Name = "CustAddress"
        pdfParameters(3).Value = "1200 West South Street"    
        pdfParameters(4) = New ParameterValue    'SQL2008.ParameterValue
        pdfParameters(4).Name = "CustCityStateZip"
        pdfParameters(4).Value = "Dallas TX 75214"    
    End Sub


    Sub asPDF()
        Dim rs As New ReportExecutionService()
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials
        rs.Url = System.Configuration.ConfigurationManager.AppSettings("sql2008.ReportExecution2005")

        ' Render arguments
        Dim result As Byte() = Nothing
        Dim reportPath As String = "/" & DirPath & "/" & ReportName
        Dim format As String = "PDF"
        Dim historyID As String = Nothing
        Dim devInfo As String = "<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>"

        Dim encoding As String = Nothing
        Dim mimeType As String = Nothing
        Dim warnings As Warning() = Nothing  'SQL2008.Warning() = Nothing
        Dim streamIDs As String() = Nothing

        Dim execInfo As New ExecutionInfo
        Dim execHeader As New ExecutionHeader
        Dim extension As String = ""

        rs.ExecutionHeaderValue = execHeader

        execInfo = rs.LoadReport(reportPath, historyID)

        rs.SetExecutionParameters(pdfParameters, "en-us")
        rs.Timeout = 600 * 1000   'timeout in milliseconds (defaults to 100,000 = 100 seconds)

        result = rs.Render(format, devInfo, extension, mimeType, encoding, warnings, streamIDs)

        Response.ClearContent()
        Response.ContentType = "application/pdf"
        Response.BinaryWrite(result)
        Response.Flush()
    End Sub

' #### this is placed in your web.config file
<appSettings>
    <add key="ReportServerURL" value="http://MyServerName/ReportServer"/>
    <add key="ReportServerName" value="MyServerName"/>
      <add key="sql2008.ReportExecution2005" value="http://MyServerName/ReportServer/ReportExecution2005.asmx"/>  
  </appSettings>
 

Toggle HighlightingOpen in New WindowSelect All

Open in new window

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36998441
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question