locked
Problem rendering Code-Behind ReportViewer in VS2010 Ultimate RRS feed

  • Question

  • User-565393983 posted

    Good day. I have the following code:

    Dim localrep As New Microsoft.Reporting.WebForms.LocalReport
    localrep.ReportPath = Server.MapPath("Report.rdlc")
    Dim reportds As New ReportDataSource("DataSet1_TbDe_Estados")
    localrep.DataSources.Add(reportds)
    localrep.Refresh()

    Dim warnings As Warning() = Nothing
    Dim streamids As String() = Nothing
    Dim mimeType As String = Nothing
    Dim encoding As String = Nothing
    Dim extension As String = Nothing
    Dim bytes As Byte()

    bytes = localrep.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)

    Response.Clear()
    Response.ContentType = mimeType
    Response.AddHeader("content-disposition", "attachment; filename=Rep_." + extension)
    Response.BinaryWrite(bytes)
    Response.Flush()
    
    
    
    
    That code works 100% on VS2005 with Framework 2.0 but I want to do the same in VS2010 ultimate with Framework 4.0. I just get:
    An error occurred during local report processing.
    As exception and I have no idea whats wrong. That code works fine on VS2005 so I was wondering if the rendering changed in VS2010 cuz everthing seems different.
    Monday, June 13, 2011 8:47 AM

Answers

  • User-565393983 posted

    Good day.

    This problem was solved in my other post.

    http://forums.asp.net/t/1689493.aspx/1?Problem+rendering+Code+Behind+ReportViewer+in+VS2010+Ultimate

    The main problem was, as chohmann said, VS2005/VS2008 uses report format associated to SQL Server 2005 and VS2010 uses the one associated to SQL Server 2010 and both are significantly different. The server that I'm using is SQL Server 2005 so I was getting an error because my proyect was pointing to SQL Server 2010 report format. What I did was changing the version from 10 to 9 of reportviewer.

    The namespace/imports that I'm using is the following:

    Imports Microsoft.Reporting.WebForms

    BTW thats the whole code that you need to render a report by code-behind.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 15, 2011 9:01 AM

All replies

  • User1471008070 posted

    Hi,

    What's your namespace? What's your error message? Could you please share you whole code-behind?

    Wednesday, June 15, 2011 3:57 AM
  • User-565393983 posted

    Good day.

    This problem was solved in my other post.

    http://forums.asp.net/t/1689493.aspx/1?Problem+rendering+Code+Behind+ReportViewer+in+VS2010+Ultimate

    The main problem was, as chohmann said, VS2005/VS2008 uses report format associated to SQL Server 2005 and VS2010 uses the one associated to SQL Server 2010 and both are significantly different. The server that I'm using is SQL Server 2005 so I was getting an error because my proyect was pointing to SQL Server 2010 report format. What I did was changing the version from 10 to 9 of reportviewer.

    The namespace/imports that I'm using is the following:

    Imports Microsoft.Reporting.WebForms

    BTW thats the whole code that you need to render a report by code-behind.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 15, 2011 9:01 AM