Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dangling Datasessions Left After Running Report
Message
From
05/09/2008 12:50:03
 
 
To
05/09/2008 11:30:29
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01345137
Message ID:
01345210
Views:
13
>>>Hi Cathy,
>>>
>>>I recently moved are apps to VFP9 (SP1) and am running into the problem you documented on your website:
>>>
>>>Gotcha: Dangling Datasession Left After Running Report
>>>If you run a report using a ReportListener from the FFC directory, and you're using a successor listener, and that report is run from a form with a private datasession, you end up with a dangling datasession after the report completes. If you keeping running reports in this manner, you keep building up more dangling datasessions. I don't think I have to tell you the consequences of a long day of running reports like this!
>>>
>>>Is this still an issue? Workarounds?
>>>
>>>Rick Hawkins
>>>RVSS
>>>(Met you at the FoxPro Users Group in Philadelphia...)
>>
>>Yes it's still an issue ... No I don't have a workaround for it. We do have code in our app to make sure we close any open DBCs before closing the form ... but that doesn't get rid of the dangling data session.
>
>I just tried something (based of a thread on Foxite) which seems to have fixed this (?)
>
>1. I saved the datasession of my form (which has the private datasession)
>2. I switched to Datasession 1 before I create my listener objects and successors
>3. I then switch back to the datasession I started with before I issue the REPORT command
>
>The report runs, and there is no dangling datasession after I exit the form. If this is working (still testing this), I wonder if listeners have some sort of presence in or want to work in datasession 1, and get stuck when they are created in any other datasession...

I had a chance to modify the code you had posted on your blog concerning this issue. Here are my changes to the code in the click of the button:

LOCAL loListener, ;
lo2

lcReport = SYS(2015)

CREATE CURSOR junk (test I)

FOR ln = 1 TO 10
INSERT INTO Junk VALUES (ln)
ENDFOR

CREATE REPORT &lcReport FROM Junk

*!* ThisForm.AddProperty('oListener', null)

SET CLASSLIB TO 'C:\Program Files\Microsoft Visual FoxPro 9\Ffc\_reportlistener'

liDataSession = SET("Datasession")

SET DATASESSION TO 1

*!* ThisForm.oListener = CREATEOBJECT('_ReportLIstener')
*!* ThisForm.olistener.listenertype = 1

*!* THisForm.AddProperty('o2', null)
*!* ThisForm.o2 = CREATEOBJECT('ReportListener')
*!* ThisForm.oListener.Successor = ThisForm.o2

loListener = CREATEOBJECT('_ReportLIstener')
lolistener.listenertype = 1

lo2 = CREATEOBJECT('ReportListener')
loListener.Successor = lo2

SET DATASESSION TO (liDataSession)

REPORT FORM &lcReport OBJECT lolistener

The report runs, and when the form is closed, the dangling datasession does not appear.
Previous
Reply
Map
View

Click here to load this message in the networking platform