Solved

Crystal Reports XI - The request could not be submitted for background processing

Posted on 2008-10-27
19
3,006 Views
Last Modified: 2013-11-15
I have a VB program (code below)  that generates a .RPT report, exports it to a PDF and emails out a link to that PDF. The program runs on Server 2003 which has the CR Engine installed (don't know how to check the version/service pack on it).

I was getting a "Load report failed" error but now I'm getting the one in the title.  When I check the Event Log I get the following message:

"Error during report execution (main try-catch): Load report failed.Error in File C:\DOCUME~1\MyUserAccount\LOCALS~1\Temp\TheReport {5E867B68-3AB8-48C0-9305-A16AF4CED465}.rpt:
The request could not be submitted for background processing..  C:\Reports"

Any ideas on what could be causing this?

I tried to go to the Business Objects site and download SP4 for the engine but pretty much all their links are broken.  As a starting point if anyone can tell me how to verify my version on the engine and give me a good link for SP4 that might do it.

Thanks for any input.


Imports System.Data

Imports System.Data.SqlClient

Imports CrystalDecisions.CrystalReports.Engine
 

Module TheReport
 
 

    Sub Main(ByVal args() As String)
 

        Dim startdate As DateTime

        Dim enddate As DateTime
 

        If args.Length = 0 Then

            Dim evtLog As New EventLog("Application")

            evtLog.Source = "TheReport Execution"

            evtLog.WriteEntry("No Report Type Defined.", EventLogEntryType.Error)

            evtLog.Close()

            evtLog.Dispose()

            Exit Sub

        End If
 

        Dim reporttype As String = UCase(args(0))

        reporttype = (StrConv(reporttype, VbStrConv.ProperCase))
 
 

        If UCase(args(0)) = "DAILY" Then

            startdate = "#" & Today.ToShortDateString & " 00:00:00 AM#"

            enddate = "#" & Today.ToShortDateString & " 11:59:59 PM#"

        Else

            enddate = "#" & DateAdd("d", -1, Today.ToShortDateString) & " 11:59:59 PM#"

            startdate = "#" & DateAdd("d", -7, Today.ToShortDateString).ToShortDateString & " 00:00:00 AM#"

        End If
 

        Dim TodayString As String = Today.Month.ToString & "-" & Today.Day.ToString & "-" & Today.Year.ToString

        Dim LastWeek As String = DateAdd("d", -7, Today.ToShortDateString).ToShortDateString

        LastWeek = Replace(LastWeek, "/", "-")
 
 

      

        Dim rptSP As ReportDocument = New ReportDocument
 

        Try

            rptSP.Load(System.Environment.CurrentDirectory & "\TheReport.rpt", 0)

            rptSP.DataSourceConnections(0).SetConnection("MyServer\MyInstance", "MyDatabase", True)
 

            Dim vals As New CrystalDecisions.Shared.ParameterValues()

            Dim x As New CrystalDecisions.Shared.ParameterDiscreteValue()

            x.Value = startdate

            Dim y As New CrystalDecisions.Shared.ParameterDiscreteValue()

            y.Value = enddate

            vals.Add(x)
 

            rptSP.DataDefinition.ParameterFields("StartDate").ApplyCurrentValues(vals)

            vals.Clear()

            vals.Add(y)

            rptSP.DataDefinition.ParameterFields("EndDate").ApplyCurrentValues(vals)
 

            Dim norecords As Boolean = False

            Try

                If UCase(args(0)) = "DAILY" Then

                    rptSP.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "D:\Reports\" & reporttype & "MyReport" & TodayString & ".pdf")

                Else

                    rptSP.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "D:\Reports\" & reporttype & "MyReport" & LastWeek & ".pdf")

                End If
 

                If rptSP.Rows.Count = 0 Then

                    norecords = True

                    rptSP.Dispose()

                End If

                rptSP.Close()

                rptSP.Dispose()

            Catch ex As Exception

                norecords = True

                Dim evtLog As New EventLog("Application")

                evtLog.Source = "TheReport Execution"

                evtLog.WriteEntry("Error during report generation (Export To Disk Block): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)

                evtLog.Close()

                evtLog.Dispose()

                Try

                    rptSP.Close()

                    rptSP.Dispose()

                Catch exs As Exception

                    Dim evtLog2 As New EventLog("Application")

                    evtLog2.Source = "TheReport Execution"

                    evtLog2.WriteEntry("Error during report generation (Close/Dispose of Report): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)

                    evtLog2.Close()

                    evtLog2.Dispose()

                End Try

            End Try
 

            Dim mail As New System.Net.Mail.MailMessage("reportserver@mydomain.com", "test@mydomain.com")
 

            If UCase(args(0)) = "DAILY" Then

                mail.Subject = "Daily Report"

            Else

                mail.Subject = "Weekly Report"

            End If
 

            If norecords Then

                If UCase(args(0)) = "DAILY" Then

                    mail.Body = "No Seizures Entered For " & Today

                Else

                    mail.Body = "No Seizures Entered For The Week Starting " & DateAdd("d", -7, Today.ToShortDateString).ToShortDateString

                End If

            Else

                If UCase(args(0)) = "DAILY" Then

                    mail.Body = "Click the link below to access the Daily Report for " & Today & Environment.NewLine & Environment.NewLine & "http://mydomain/Reports/" & reporttype & "Report" & TodayString & ".pdf"

                Else

                    mail.Body = "Click the link below to access the Weekly Report for the week starting " & DateAdd("d", -7, Today) & Environment.NewLine & Environment.NewLine & "http://mydomain/Reports/" & reporttype & "Report" & LastWeek & ".pdf"

                End If

 
 

            End If
 

            Dim cn As New SqlConnection("Data Source=MyDatabase\MyInstance;Initial Catalog=MyDatabase;Integrated Security=SSPI;")

            Dim cmd As SqlCommand = cn.CreateCommand

            cn.Open()

            If UCase(args(0)) = "DAILY" Then

                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE daily=1 "

            Else

                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE weekly=1""

            End If

            Dim rdr As SqlDataReader = cmd.ExecuteReader

            While rdr.Read

                Try

                    mail.To.Add(rdr("email"))

                Catch ex As Exception

                    Dim evtLog As New EventLog("Application")

                    evtLog.Source = "TheReport Execution"

                    evtLog.WriteEntry("Error during report execution (while adding main recipients): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)

                    evtLog.Close()

                    evtLog.Dispose()

                End Try
 

            End While

            rdr.Close()

            cn.Close()
 

            Try

                If UCase(args(0)) = "WEEKLY" Then

                    Dim s As New IO.StreamReader("people.txt")

                    While Not s.EndOfStream

                        Try

                            mail.CC.Add(s.ReadLine)

                        Catch ex As Exception

                            Dim evtLog As New EventLog("Application")

                            evtLog.Source = "TheReport Execution"

                            evtLog.WriteEntry("Error during report execution (while adding extra people): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)

                            evtLog.Close()

                            evtLog.Dispose()

                        End Try

                    End While

                    s.Close()

                End If

            Catch ex As Exception

            End Try
 

            If mail.To.Count > 0 Then

                Dim smtpMe As New System.Net.Mail.SmtpClient()

                smtpMe.Host = "mysmtpserver"

                smtpMe.Send(mail)

            End If
 

        Catch ex As Exception

            Dim evtLog As New EventLog("Application")

            evtLog.Source = "TheReport Execution"

            evtLog.WriteEntry("Error during report execution (main try-catch): " & ex.Message & ex.InnerException.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)

            evtLog.Close()

            evtLog.Dispose()

        Finally

            Try

                rptSP.Close()

                rptSP.Dispose()

            Catch ex As Exception

            End Try

        End Try
 

    End Sub
 

End Module

Open in new window

0
Comment
Question by:synapse88
  • 8
  • 8
19 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
which line is causing the error?
0
 

Author Comment

by:synapse88
Comment Utility
I can't tell that.  The only error information I have is what I posted in the question.  If there's some code I can add which will give me more exception information just let me know and I'll add it and run the program again.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
remove your try catch to debug.
0
 

Author Comment

by:synapse88
Comment Utility
I don't follow.  The Try Catch (and associated exception handling) is the only way I'm able to get the error info I posted above.  Without that it will just error out with no exception info (that I know of).
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
You don't have this error on your own computer? Only when it runs on the server? If that's the case, to find out which line you can use tracing (see http://www.emoreau.com/Entries/Articles/2003/11/Code-diagnostic-an-article-on-tracing-and-debugging.aspx) or add messagebox in your application to find out which line.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
I had this error once a while ago and it was because I was missing one CR DLL file (but I don't remember which one).
0
 

Author Comment

by:synapse88
Comment Utility
I was thinking that might be the case, that's why I was hoping someone might be able to help determining what version of the CR engine running and how to install the SP4 for it.

0
 

Author Comment

by:synapse88
Comment Utility
Ok when I comment out the code I attached below, it works just fine
            Dim cn As New SqlConnection("Data Source=MyDatabase\MyInstance;Initial Catalog=MyDatabase;Integrated Security=SSPI;")

            Dim cmd As SqlCommand = cn.CreateCommand

            cn.Open()

            If UCase(args(0)) = "DAILY" Then

                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE daily=1 "

            Else

                cmd.CommandText = "SELECT emailaddy FROM theusers WHERE weekly=1""

            End If

            Dim rdr As SqlDataReader = cmd.ExecuteReader

            While rdr.Read

                Try

                    mail.To.Add(rdr("email"))

                Catch ex As Exception

                    Dim evtLog As New EventLog("Application")

                    evtLog.Source = "TheReport Execution"

                    evtLog.WriteEntry("Error during report execution (while adding main recipients): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)

                    evtLog.Close()

                    evtLog.Dispose()

                End Try

 

            End While

            rdr.Close()

            cn.Close()

Open in new window

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:synapse88
Comment Utility
Now the only part of the code in my post above I commented out is:

                    Dim evtLog As New EventLog("Application")
                    evtLog.Source = "TheReport Execution"
                    evtLog.WriteEntry("Error during report execution (while adding main recipients): " & ex.Message & ".  " & System.Environment.CurrentDirectory, EventLogEntryType.Error)
                    evtLog.Close()
                    evtLog.Dispose()


And it still works.  So I can only assume that this code was causing the error.  Any guesses as to why?
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
>>Any guesses as to why?

I can't see how those lines relate to the error of Crystal Reports
0
 

Author Comment

by:synapse88
Comment Utility
Neither do I.  I have the task scheduled to run on its own tonight (as opposed to me invoking it to test which is what i've been doing) so we'll see if it runs ok...
0
 

Author Comment

by:synapse88
Comment Utility
ok so I'm starting to think it's not just the VB code I posted above.

another unrelated Crystal Report is giving me the same error now.

"Error during report execution (main try-catch): Load report failed.Error in File C:\DOCUME~1\MyUserAccount\LOCALS~1\Temp\TheReport {5E867B68-3AB8-48C0-9305-A16AF4CED465}.rpt:
The request could not be submitted for background processing

So it seems like it has something to do with that temp folder...
Anything that can help me ensure my engine is patched would be a big help.

Thanks!
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
1- do you have this error when the application is running from the scheduler only or do you have it also when you run the application interactively?

2- Can you check if your installation on the server has every file? Compare the CR folder of the server with the own on your dev PC (something like C:\Program Files\Common Files\Business Objects\2.7\Bin)

0
 

Author Comment

by:synapse88
Comment Utility
1) It's currently happening when it's running from the scheduler, or invoked by me.

2) I checked the server and the files are located in:
Program Files\Common Files\Business Objects\3.0\crystalreportviewers11
(crystalreportviewers is the only folder in the 3.0 folder)
Does the 3.0 mean that SP3 is installed?

I checked on my dev pc and the files are located in:
C:\Program Files\Business Objects\common\3.5


And I don't know any easy way to compare files between the two.  There are a high number of files folders involved.

Can anyone find a link for the SP4? I have a feeling that might be needed here.
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
Comment Utility
you can use WinDiff (http://www.grigsoft.com/download-windiff.htm) to compare folders
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
I think that I deserve the points here
0
 

Expert Comment

by:fireprograms_tech
Comment Utility
I have a customer who was having a very similiar error message  (Error in file C:\DOCUME~1\rmarianna\lisa\temp<guid>.rpt: The request could not be submitted for background processing).  What I did to resolve this was to give Network Service everything but full control to the folder in which my application was running from (also where the reports were located) and it resolved it.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

12 Experts available now in Live!

Get 1:1 Help Now