Solved

Error during local report processing

Posted on 2014-10-22
6
305 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now