Solved

Error during local report processing

Posted on 2014-10-22
6
298 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Tabcontrol Caption? 1 24
Change data in datatable 8 16
Round up to 100% in .NET 10 45
SQL Server Communications Audit 5 28
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 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

17 Experts available now in Live!

Get 1:1 Help Now