AdoServer BookMark property

This forum is the place to discuss issues related to ReportPro, Xs2Ado, Vo2Ado, bBrowser and other 3rd party products
Post Reply
User avatar
Kees Bouw
Posts: 97
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

AdoServer BookMark property

Post by Kees Bouw »

Hi,

With my current VO to X# conversion project I am having a problem with the BookMark property of the AdoServer class. In X#, when there are no records, and BOF and EOF are both true, I get a runtime error like “((Xs2Ado.AdoServer)((bTools.bBrowser.bBrowser)(oRE:Window).Value).Server.Value).BookMark' threw an exception of type 'XSharp.Error'” In the debugger (picture below) you can see the BookMark.Message which is "Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record." In the VO version there is no BookMark property visible in the debug information, and there is no error when both BOF and EOF are true. Is there something I can do to avoid this error in X#?
(In the picture, variable Result is of class BPSQLSelect which inherits from AdoServer.)

Image

Kees.
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: AdoServer BookMark property

Post by robert »

Kees,
I assume RightsManager.BPSelect is your own class.
I would recommend to change its property Bookmark to check for EOF and BOF and return NULL or something like that when these are true.
Or put a TRY CATCH in there and return NULL from the CATCH code

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Kees Bouw
Posts: 97
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Re: AdoServer BookMark property

Post by Kees Bouw »

robert wrote: Fri Feb 02, 2024 2:45 pm Kees,
I assume RightsManager.BPSelect is your own class.
I would recommend to change its property Bookmark to check for EOF and BOF and return NULL or something like that when these are true.
Or put a TRY CATCH in there and return NULL from the CATCH code

Robert
Robert,

The property BookMark is not used at all in the application, the word does not even appear anywhere in the code. But I have added an access like this

Code: Select all

ACCESS BookMark CLASS BPSQLSelect
// CLASS BPSQLSelect INHERIT AdoServer

LOCAL uReturn AS USUAL

IF SELF:BoF .OR. SELF:EoF
	uReturn := NULL
ELSE
	uReturn := SUPER:BookMark
ENDIF

RETURN uReturn
Is this what you meant? Unfortunately it makes no difference. My impression is that the internal code of Xs2Ado tries to create or access a bookmark property every time an event occurs in the window or the bBrowser that uses the server. And that maybe the code cannot handle BoF or EoF situations and generates a run-time error. The run-time error always occurs in methods like Resize, Show and Dispatch. I hope I am wrong and that there is a simple solution because I can't run the application and it is really a problem.

Kees.
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: AdoServer BookMark property

Post by robert »

Kees,
When I try it here and add the following code to a subclass of AdoServer then there is no error in the Bookmark property when the server is at EOF

Code: Select all

ACCESS BookMark
    IF SELF:EOF .or. SELF:BOF
        RETURN NULL
    ENDIF
    RETURN SUPER:BookMark
Btw: that property is NOT used anywhere in the Xs2Ado code. The Bookmark property of the server class is simply a wrapper around the BookMark property of the AdoRecordSet.

Maybe the bBrowser code uses it or a library that you are using in your app?
And of course, if you display the server object in the debugger and examine its properties, then all properties, including BookMark are evaluated.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Kees Bouw
Posts: 97
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Re: AdoServer BookMark property

Post by Kees Bouw »

robert wrote: Mon Feb 05, 2024 10:26 am Kees,
When I try it here and add the following code to a subclass of AdoServer then there is no error in the Bookmark property when the server is at EOF
Robert
Robert,

You are right, with the ACCESS the error is gone in the debug information even when BoF and EoF are both TRUE.

But... I still get the runtime error:

Image

When I click on "View Details" I also see error XS0726 here but that probably is not related to the runtime error?

When I click on "Copy Details" I get the report below. It would be nice to see all line numbers and not just two, how can I accomplish this?
At the bottom there are 3 "Inner Exceptions" about a "Requested operation", is there any way to get more information about what this "Requested operation" exactly is? The error occurs in the Show() method of a window.

XSharp.Error
HResult=0x80131500
Message=Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Source=XSharp.RT
StackTrace:
RECORDSETCLASS:MOVE (Line: 0)
ADORECORDSET:MOVE (Line: 0)
ADOCREATEERROR (Line: 0)
ADOOBJECT:HANDLEEXCEPTION (Line: 0)
ADORECORDSET:MOVE (Line: 0)
ADOSERVER:SKIP (Line: 0)
RUNTIMEMETHODHANDLE:INVOKEMETHOD (Line: 0)
RUNTIMEMETHODINFO:UNSAFEINVOKEINTERNAL (Line: 0)
RUNTIMEMETHODINFO:INVOKE (Line: 0)
METHODBASE:INVOKE (Line: 0)
OOPHELPERS:SENDHELPER (Line: 0)
OOPHELPERS:SENDHELPER (Line: 0)
OOPHELPERS:DOSEND (Line: 0)
__INTERNALSEND (Line: 0)
BBROWSER:__SKIP (Line: 0)
BBROWSER:CACHEUPDATE (Line: 0)
BBROWSER:RECALCULATE (Line: 0)
BBROWSER:RESIZE (Line: 0)
CONTROL:DISPATCH (Line: 0)
__WCCONTROLPROC (Line: 0)
CALLWINDOWPROC (Line: 0)
BEVENTHANDLER (Line: 0)
CALLWINDOWPROC (Line: 0)
__WCCONTROLPROC (Line: 0)
CALLWINDOWPROC (Line: 0)
BEVENTHANDLER (Line: 0)
CALLWINDOWPROC (Line: 0)
__WCCONTROLPROC (Line: 0)
CALLWINDOWPROC (Line: 0)
__WCCONTROLPROC (Line: 0)
SETWINDOWPOS (Line: 0)
SPLITWINDOW:__RESIZESPLITVIEW (Line: 0)
SPLITWINDOW:RESIZE (Line: 0)
RUNTIMEMETHODHANDLE:INVOKEMETHOD (Line: 0)
RUNTIMEMETHODINFO:UNSAFEINVOKEINTERNAL (Line: 0)
RUNTIMEMETHODINFO:INVOKE (Line: 0)
METHODBASE:INVOKE (Line: 0)
OOPHELPERS:SENDHELPER (Line: 0)
OOPHELPERS:SENDHELPER (Line: 0)
OOPHELPERS:DOSEND (Line: 0)
__INTERNALSEND (Line: 0)
__DOCAPP:DISPATCH (Line: 0)
__WCDOCAPPWNDPROC (Line: 0)
CALLWINDOWPROC (Line: 0)
BEVENTHANDLER (Line: 0)
DEFMDICHILDPROC (Line: 0)
__DOCAPP:DEFAULT (Line: 0)
CHILDAPPWINDOW:DEFAULT (Line: 0)
WINDOW:DISPATCH (Line: 0)
APPWINDOW:DISPATCH (Line: 0)
SPLITWINDOW:DISPATCH (Line: 0)
__DOCAPP:DISPATCH (Line: 0)
__WCDOCAPPWNDPROC (Line: 0)
CALLWINDOWPROC (Line: 0)
BEVENTHANDLER (Line: 0)
SHOWWINDOW (Line: 0)
WINDOW:SHOW (Line: 0)
APPWINDOW:SHOW (Line: 0)
__DOCAPP:SHOW (Line: 0)
CHILDAPPWINDOW:SHOW (Line: 0)
SPLITWINDOW:SHOW (Line: 0)
XAPP:START (Line: 98)
STARTRM (Line: 10)
FORM1:RMBUTTON_CLICK (Line: 44)
CONTROL:ONCLICK (Line: 0)
BUTTON:ONCLICK (Line: 0)
BUTTON:ONMOUSEUP (Line: 0)
CONTROL:WMMOUSEUP (Line: 0)
CONTROL:WNDPROC (Line: 0)
BUTTONBASE:WNDPROC (Line: 0)
BUTTON:WNDPROC (Line: 0)
CONTROL:CONTROLNATIVEWINDOW:ONMESSAGE (Line: 0)
CONTROL:CONTROLNATIVEWINDOW:WNDPROC (Line: 0)
NATIVEWINDOW:DEBUGGABLECALLBACK (Line: 0)
UNSAFENATIVEMETHODS:DISPATCHMESSAGEW (Line: 0)
APPLICATION:COMPONENTMANAGER:SYSTEM.WINDOWS.FORMS.UNSAFENATIVEMETHODS.IMSOCOMPONENTMANAGER.FPUSHMESSAGELOOP (Line: 0)
APPLICATION:THREADCONTEXT:RUNMESSAGELOOPINNER (Line: 0)
APPLICATION:THREADCONTEXT:RUNMESSAGELOOP (Line: 0)
APPLICATION:RUN (Line: 0)
START (Line: 14)


Inner Exception 1:
Error: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

Inner Exception 2:
Error: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

Inner Exception 3:
COMException: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: AdoServer BookMark property

Post by robert »

Kees,
I need to have an example to be able to explain this

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply