Progress v9 & Crystal Reports RDC

phirst

New Member
Hi all,

I am using Progress v9.1a and Crystal Reports 8 RDC.

I have one problem to which I just CANNOT find the solution, and I have checked out all the forums and sites I know.

I connect to CR8:
DEF VAR chSCR AS COM-HANDLE NO-UNDO.
CREATE "CrystalRuntime.Application" chSCR CONNECT NO-ERROR.
/* in case it is already up */
IF ERROR-STATUS:ERROR THEN
CREATE "CrystalRuntime.Application" chSCR.

I then connect my db:
NO-RETURN-VALUE chSCR:LogOnServer("{&DLL}",
"{&DRIVER}",
"{&DB}",
"{&USER}",
"{&PASSWORD}").

Open the report:
DEF VAR chRep AS COM-HANDLE NO-UNDO.
chRep = chSCR:Openreport("{&RPT}").

I do some parameter passing here...

Print the report:
/* 1 copy for test */
chRep:printOut(FALSE,1,TRUE).

I have trouble cleaning up:
/* release the report - THIS OBVIOUSLY DOES NOT WORK! */
IF VALID-HANDLE(chRep) THEN
RELEASE OBJECT chRep.

/* they say you should assign "nothing" to this variable (in VB) so I do this */
chRep = ?.
/* DOES NOT MAKE ANY DIFFERENCE */

*** here is the problem ***
/* THIS DOES NOT WORK */
NO-RETURN-VALUE chSCR:LogOffServer("{&DLL}",
"{&DRIVER}",
"{&DB}",
"{&USER}",
"{&PASSWORD}") NO-ERROR.

*** I get an error, saying the connection is still in use, obviously by the report ****
DEFINE VARIABLE cnt AS INTEGER NO-UNDO.
DO Cnt = 1 TO ERROR-STATUS:NUM-MESSAGES:
MESSAGE
ERROR-STATUS:GET-MESSAGE(Cnt)
"(" ERROR-STATUS:GET-NUMBER(Cnt) ")"
VIEW-AS ALERT-BOX INFO.
END.

/* I guess this works, or at least I hope so */
RELEASE OBJECT chSCR.

How do I release the report?
I am using up all the login connections because I cannot logout.

I would much appreciate your help.
Thanks a lot.

phirst.
 
Top