cancel
Showing results for 
Search instead for 
Did you mean: 

Error in file ...rpt : Database Connector Error

Former Member
0 Kudos

Hello everyone,

I recently came across a strange problem whose source i can't find. I am using printToPrinter function to print a report to a printer. My application prints more than 300 reports continuously one after the other. The way i do this is as follows:

1. I create the datasource in asp.net

2. I insert the datasource in crystal reports datasource property

3. I call printToprinter

4. I close and dispose the ReportDocument object that i use to do the previous steps.

5. I continue to the next report and so on...

When i run the application from my development machine the reports print successfully. When my client whose pc is far away tries to print, sometimes and not always, one of the reports crashes in the line of code where i have put the printToPrinter method and the error is :

Error in file c:\windows\temp\myreport.rpt :

Database Connector Error

Does anyone know what causes this strange behavior? And why does this happen occasionally?

Thanks a lot in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You're closing the reports after you finish printing them, but are you calling .Dispose() on them? The Crystal SDK is really a wrapper around COM objects. Code written in Visual Studio does not automatically memory manage COM objects well (if at all!) so you have to do one of two things: either explicitly call .Dispose() when you're done with a report or put the report in a "Using" structure like this (assuming C# code behind - I don't know how this works in VB!):


Using (ReportDocument myRpt = New ReportDocument())
{
  //insert code to load and print report here
}

Another issue might be due to network latency. If your user is indeed "far away" from where the application is running and is printing to a printer local to him, then any network slow-down or things like packet errors would affect communication between the application and the user and cause the print command to error out.

-Dell

Former Member
0 Kudos

Dear Dell,

I am calling both Dispose() and Close().

Do you think there might be something other than network connection?

Best Regards!

Former Member
0 Kudos

Is there any way that you can test this from another workstation? Is this person the only one who uses this app? Printing 300 reports, one after the other, is a LOT of work and you have to have a completely stable, low latency network connection to make it work.

The thought just occurred to me that the issue might also be on the printer end - if the printer's spooling "memory" gets full, that might also cause the problem. You could try putting a short pause (second or two) after every 10 or 20 reports to give the printer time to catch up and see if that helps.

-Dell

Former Member
0 Kudos

Dear Dell,

I will try the solution with the intervals and see what will happen.

thanks a lot for your contribution

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks a lot for the help.