Last post Jun 15, 2011 09:01 AM by jonathandp01
Jun 13, 2011 08:47 AM|jonathandp01|LINK
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.
Jun 15, 2011 03:57 AM|You-Hu Fu|LINK
What's your namespace? What's your error message? Could you please share you whole code-behind?
Jun 15, 2011 09:01 AM|jonathandp01|LINK
This problem was solved in my other post.
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:
BTW thats the whole code that you need to render a report by code-behind.