Skip to Content
author's profile photo Former Member
Former Member

Error in file ...rpt : Database Connector Error

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!

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2010 at 08:05 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 27, 2010 at 07:19 AM

    Thanks a lot for the help.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.