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.)
Kees.
AdoServer BookMark property
Re: AdoServer BookMark property
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
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
The Netherlands
robert@xsharp.eu
Re: AdoServer BookMark property
Robert,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
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
Kees.
Re: AdoServer BookMark property
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
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
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
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
The Netherlands
robert@xsharp.eu
Re: AdoServer BookMark property
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:
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.
Re: AdoServer BookMark property
Kees,
I need to have an example to be able to explain this
Robert
I need to have an example to be able to explain this
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu