We have an application in which we integrated Crystal Reports.
On the client we have a documentmanager that sends asynchronous calls to appserver . The document is put in a temp-table (BLOB) on appserver and sent to the client for preview.
The connection from crystal reports is set with ConnectionProperties for each table in the report (and every table in subreport).
This works OK for one user, but when different users, we don't get any document anymore.
What we see is that for every client we have a pub user to database and that user stays there ...
How can we logoff that user when report is finished ?
create "CrystalRuntime.Application":u vchApplication.
create "CrystalRuntime.Report":u vchReport.
vchReport = vchApplication:OpenReport(this-object:pReportFileName).
vchReport:DiscardSavedData().
do vi = 1 to vchReport:Database:Tables:Count:
vchConnProps = vchReport:Database:Tables(vi):ConnectionProperties.
vchConnProps:DeleteAll.
assign
vcTableName = vchReport:Database:Tables(vi):name.
find ttConfig no-lock
where ttConfig.ttType eq "TABLECONNECTION":u
and ttConfig.ttParameterName eq vcTableName no-error.
if available(ttConfig) then
do:
find bttConfig no-lock
where bttConfig.ttType eq "ODBC":u
and bttConfig.ttParameterName eq "CONNECTION":u
and entry(1,bttConfig.ttParameterValue,"|":u) eq ttConfig.ttParameterValue no-error.
if available(bttConfig)
then
vchConnProps:add("Connection String":u, entry(2,bttConfig.ttParameterValue,"|":u)).
end.
end.
Finally export the records and print to PDF.
vchReport:ReadRecords.
/* Get the handle of the Report's ExportOptions Object */
assign
vchExportOptions = vchReport:ExportOptions.
case this-object:pOutputFormat :
when "PDF":u then
do:
/* set the export settings */
end.
end.
/* No information message will be displayed if the line below is commented out */
vchReport:DisplayProgressDialog = false.
/* Export the report without prompting the user. */
/* Use EXPORT(TRUE) to prompt the user. */
vchReport:EXPORT(false).
release object vchDatabase .
release object vchParameterFields .
release object vchExportOptions .
release object vchConnProps .
release object vchSingleSection .
release object vchSubReportObject .
release object vchSubReport .
release object vchReport.
release object vchApplication.
assign
vchApplication = ?
vchReport = ?
vchDatabase = ?
vchParameterFields = ?
vchExportOptions = ?
vchConnProps = ?
vchSingleSection = ?
vchSubReportObject = ?
vchSubReport = ?
.
Kind regards
Gerd
All,
this was caused by a bad clean up of com-handles...
the connection properties com-handle had to be released every time it was set
I only cleaned up the last one
cheers
gerd