Solved

Error during local report processing

Posted on 2014-10-22
6
342 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
[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
  • 4
  • 2
6 Comments
 
LVL 29

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
How our DevOps Teams Maximize Uptime

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

 

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 29

Expert Comment

by:sammySeltzer
ID: 40402160
Good for you!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

710 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