473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

An error occurred during local report processing

I am stuck with the error I have posted above in the question title

I am developing ASP.NET 2.0 web site and I have added a new rdlc file
to my project by using the following process:

-Right clicking my project in the Solutions explorer
-Selecting Add New Item
-Selecting Report.rdlc template
-Renaming it to Main.Rdlc and then clicking OK.

As you know that rdlc file is a local report file that runs on the
client side (no reporting server needed in this case). While I add this
file, a wizard appears that prompts me the connection string from my
Web Config file and allows me to select the existing stored procedure I
want to use to display the data to my report. I can see the output
columns of the stored procedure in the left pane and the report
designer in the right pane. I have done a drag and drop of those
columns from the left pane to the report designer of main.rdlc file in
the right pane and saved the main.rdlc file. Now I want to render this
main.rdlc file programatically. Following is the code I am using:

Imports System.Web.Configuration
Imports System.Security.Principal
Imports System.data.DataSet
Imports System.data.SqlClient
Imports System.IO
Imports System.Xml
Imports Microsoft.Reporting.WebForms
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing.Imaging
Imports System.Drawing.Printing

Protected Sub btnReport_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnReport.Click

Dim warnings As Microsoft.Reporting.WebForms.Warning() =
Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim lr As New LocalReport

lr.ReportPath = "C:\Projects\Marketing Initiatives\Main.rdlc"

lr.DataSources.Add(New ReportDataSource("FSI", FSIList))
'FSIList is a datatable thta I have previously returned in another
method

Export(lr)

m_currentPageIndex = 0
PrintReport()

End Sub

Private Sub Export(ByVal report As LocalReport)
Dim deviceInfo As String = _
"<DeviceInfo>" + _
" <OutputFormat>EMF</OutputFormat>" + _
" <PageWidth>8.5in</PageWidth>" + _
" <PageHeight>11in</PageHeight>" + _
" <MarginTop>0.25in</MarginTop>" + _
" <MarginLeft>0.25in</MarginLeft>" + _
" <MarginRight>0.25in</MarginRight>" + _
" <MarginBottom>0.25in</MarginBottom>" + _
"</DeviceInfo>"
Dim warnings() As Warning = Nothing
m_streams = New List(Of Stream)()

Try
report.Render("Image", deviceInfo, AddressOf CreateStream,
_
warnings)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try

Dim stream As Stream
For Each stream In m_streams
stream.Position = 0
Next
End Sub

Private Function CreateStream(ByVal name As String, _
ByVal fileNameExtension As String, _
ByVal encoding As Encoding, ByVal mimeType As String, _
ByVal willSeek As Boolean) As Stream
Dim stream As Stream = _
New FileStream("..\..\" + _
name + "." + fileNameExtension, FileMode.Create)
m_streams.Add(stream)
Return stream
End Function

Private Sub PrintReport()
Const printerName As String = _
"Microsoft Office Document Image Writer"

If m_streams Is Nothing Or m_streams.Count = 0 Then
Return
End If

Dim printDoc As New PrintDocument()
printDoc.PrinterSettings.PrinterName = printerName
If Not printDoc.PrinterSettings.IsValid Then
Dim msg As String = String.Format( _
"Can't find printer ""{0}"".", printerName)
Console.WriteLine(msg)
Return
End If
AddHandler printDoc.PrintPage, AddressOf PrintPage
printDoc.Print()
End Sub

Private Sub PrintPage(ByVal sender As Object, _
ByVal ev As PrintPageEventArgs)
Dim pageImage As New Metafile(m_streams(m_currentPageIndex))
ev.Graphics.DrawImage(pageImage, ev.PageBounds)

m_currentPageIndex += 1
ev.HasMorePages = (m_currentPageIndex < m_streams.Count)
End Sub
The problem is that in the Export sub above, I get the following error
method in the following line of the code:

Try
report.Render("Image", deviceInfo, AddressOf CreateStream,
_
warnings)
Catch ex As Exception
Console.WriteLine(ex.Message)
'''Error ex.Message = "An error occurred during local report
processing"
End Try

Does anyone has a clue what am I doing wrong in the code above...
I will really appreciate for a help,

Thanks a lot

Apr 27 '06 #1
0 7403

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Russ | last post by:
I have a page that uses crystal reports to generate reports from a SQl server database. As of a week ago everything was working fine, but now I am all of the sudden getting errors. To the best of...
2
by: menkaur | last post by:
I tried to generate asp Application project( I’m using VS .Net 2003). After I did ,following errors occurred (runtime):...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
0
by: AnalogKid17 | last post by:
<full error> An error has occurred during report processing. Exception has been thrown by the target of an invocation. Login failed for user '\$'. </full error> I have a web based winforms app...
0
by: Andrew | last post by:
Need help figuring out the issue here. One of my coworkers builds an ASP.Net 2.0 Web Site that displays a single SQL Report using the Report Viewer Control. This is the first time she has done...
17
by: =?Utf-8?B?SGVyYg==?= | last post by:
I have created a report and subreport in VB/ASP.NET. The report works fine but the subreport will not display. The subreport, when displayed as a standalone report, works fine. Any help I can...
4
by: dancer | last post by:
I get this error if an item in a radiobutton list is not chosen when filling in a form.. I added a RequiredFieldValidator, but I still get the message. Object reference not set to an instance of...
3
by: dancer | last post by:
I am using Framework 1.1.4322. Who can tell me why I'm getting this error? My code follows Compilation Error Description: An error occurred during the compilation of a resource required to...
0
by: Brian | last post by:
More and more I seem to be running into the error: An error occurred during local report processing. I am using VS2008/VB and all reports have the following properties set: Build action :...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.