Solved

Error during local report processing

Posted on 2014-10-22
6
337 Views
Last Modified: 2014-10-24
OK, so this might be difficult to explain but bear with me :)

I have an ASPX (VB) page on which I need to print a .rdlc report; note: I'm not using a reportViewer as I'm streaming directly to the printer without previewing.

When I create the report with a single text box with static text, every thing woks fine.

As soon as I add a DataSet to the report I get an error when I try to render the report to the stream "An error occurred during local report processing." . Even though I have not added any of the fields in the dataset to the report yet. The dataset itself is a very simply query which returns 1 row with 1 col (a single value)

The code to print the report is as follows:

In the Button Click event:
 Dim report As New LocalReport()
 report.ReportPath = "Reports\myReport.rdlc"
 report.Refresh()

' Export the report to an EMF file 
export(report, "test")

' Print the report
  print("test")
<snip>

Open in new window


The export function:
 Private Function export(ByVal report As LocalReport, ByVal pApp As String) As String

        ' gets printer device info, orientation & page size etc....
        Dim deviceInfo As String = getPrinterDeviceInfo(pApp)
        Dim warnings As Warning()

        mStreams = New List(Of Stream)()

        Try
        <THE NEXT LINE THROWS THE ERROR>     
       report.Render("Image", deviceInfo, AddressOf createStream, warnings)

        Catch ex As Exception
            Dim a As String = ex.Message

        End Try

        For Each stream As Stream In mStreams
            stream.Position = 0
        Next

        Return "SUCCESS"

    End Function

Open in new window


I'm using this exact same method to print other reports in the project but those report don't need any dataset as they are all static text and they print perfectly.
0
Comment
Question by:BrianFord
  • 4
  • 2
6 Comments
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 40400071
It sounds like a connection issue to me.

If you process it with static data with no issues, then check your connection string to the database.
0
 

Author Comment

by:BrianFord
ID: 40400336
Good point,

I'll check that out but I'm pretty sure the connection string OK as the same is being used for other functions (and reports) in the same application, but definitely worth checking

thanks
0
 

Author Comment

by:BrianFord
ID: 40400357
Checked the connection string and it's fine, but still get the error :(
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

Author Comment

by:BrianFord
ID: 40400540
OK, so I looked a bit further into the connection and although the connection string is correct, there is no actual call to the database being made.

I verified this by using the SQL Server Profiler and capturing every call made from this application/user and nothing is hitting the database.
0
 

Author Closing Comment

by:BrianFord
ID: 40400652
Thanks for your help, although the issue was not the connection string directly, it did point me in the right direction.

I had to setup the connection and data table etc. in the code before trying to render the report, I've pasted the code below for anyone else having this problem :)

Dim report As New LocalReport()
Dim myConn As String = ConfigurationManager.ConnectionStrings("myConnectionString").ToString()
Dim myAdapter As New SqlDataAdapter("SELECT TOP(1) formName FROM formNames", myConn)
Dim myDataSet As New DataSet()

myAdapter.Fill(myDataSet)
Dim myDataSource As ReportDataSource = New ReportDataSource("DataSet1", myDataSet.Tables(0))

report.DataSources.Clear()
report.DataSources.Add(myDataSource)
report.ReportPath = "Reports\myReport.rdlc"
report.Refresh()
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 40402160
Good for you!
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

679 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