I keep hearing about this "Twitter" thing so I decided to check it out. I created an account so I can start following a few people and see if this is something I want to continue doing. Heck, I might even make a few posts myself. But to be honest .. I'm afraid this might become a time zapper .. so I decided I would try it out for a short time and decide whether I want to continue with it.
If you Twitter .. let me know and I'll add you to my list.
Sunday, September 28, 2008
Monday, September 8, 2008
Workaround: Dangling Datasession Left After Running Report
In December, 2007, I posted about a bug in VFP 9 that causes a dangling datasession after running a report from form with a private datasession and using report listeners chained together as successors. Microsoft still hasn't fixed the problem, but I now have a workaround for the bug.
First of all ... I have to give credit where credit is due. I didn't come up with the solution. It was given to me by Rick Hawkins ... so thanks Rick!! But now that I have the solution, I want to share it with everyone who follows my blog (all three of you.)
The solution is actually quite simple ... just before you instantiate any report listener object, switch to datasession 1, instantiate the object, then switch back to the previous datasession.
LOCAL lnDataSession, loListener, loListener2
lnDataSession = SET('DataSession')
SET DATASESSION TO 1
loListener = CREATEOBJECT('ReportListener')
loListener.ListenerType = 1
loListener2 = CREATEOBJECT('ReportListener')
loListener.Successor = m.loListener2
SET DATASESSION TO (m.lnDatSession)
REPORT FORM Whatever OBJECT m.loListener
I'd rather Microsoft fix the bug, but I guess a workaround is the next best thing!
First of all ... I have to give credit where credit is due. I didn't come up with the solution. It was given to me by Rick Hawkins ... so thanks Rick!! But now that I have the solution, I want to share it with everyone who follows my blog (all three of you.)
The solution is actually quite simple ... just before you instantiate any report listener object, switch to datasession 1, instantiate the object, then switch back to the previous datasession.
LOCAL lnDataSession, loListener, loListener2
lnDataSession = SET('DataSession')
SET DATASESSION TO 1
loListener = CREATEOBJECT('ReportListener')
loListener.ListenerType = 1
loListener2 = CREATEOBJECT('ReportListener')
loListener.Successor = m.loListener2
SET DATASESSION TO (m.lnDatSession)
REPORT FORM Whatever OBJECT m.loListener
I'd rather Microsoft fix the bug, but I guess a workaround is the next best thing!
Labels:
datasession,
Gotcha,
Report,
VFP,
Workaround
Subscribe to:
Posts (Atom)