Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

Error during local report processing

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
BrianFord
Asked:
BrianFord
  • 4
  • 2
1 Solution
 
sammySeltzerCommented:
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
 
BrianFordAuthor Commented:
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
 
BrianFordAuthor Commented:
Checked the connection string and it's fine, but still get the error :(
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
BrianFordAuthor Commented:
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
 
BrianFordAuthor Commented:
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
 
sammySeltzerCommented:
Good for you!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now