Page 1 of 1
bug xBrowse ADO
Posted: Mon Jul 06, 2015 7:56 pm
by MOISES
Hello,
I am getting this error reported by some customers:
Error description: Error BASE/1004 No existe el m‚todo: RECORDCOUNT
Args:
[ 1] = U
Stack Calls
===========
Called from: => RECORDCOUNT( 0 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE_SETADO( 4556 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE( 438 )
Offending line:
::
bGoBottom := {|| If( ::oRs:RecordCount() > 0, ::oRs:MoveLast(), nil ) },;
Can you please verify at METHOD SetAdO( oRs, lAddCols, lAutoOrder, aFldNames ) CLASS TXBrowse that oRs is not nil?.
Thank you.
Re: bug xBrowse ADO
Posted: Mon Jul 06, 2015 9:50 pm
by Rick Lipkin
Moises
I have seen this error if you close the recordset and xBrowse is trying to refresh itself especially in a MDI environment. Rao has a codeblock you should call but I can not recall it off hand... hopefully he will chime in here and tell you what the syntax is and how to use it .. I will search the forum and see if I can find the codeblock for you.
Rick Lipkin
ps .. here it is :
Re: bug xBrowse ADO
Posted: Mon Jul 06, 2015 11:51 pm
by nageswaragunupudi
This error can be expected in two cases.
1) If the recordset is opened with adUseServer.
2) Recordset is closed in WHEN clause and there are still some buttons or controls that keep referring to the recordset.
Advice:
a) If the browse is on MDICHILD window, close the recordset in oWnd:bPostEnd.
eg: oWnd:bPostEnd := { || oRs:Close() }. By the time the recordset is closed all controls on the window are already destroyed.
b) If the browse is on MODAL DIALOG, close the recordset after ACTIVATE DIALOG command.
c) If the browse is on a NON-MODAL DIALOG or a normal Window (other than main window) only place to close recordset is in WHEN clause. In the when clause, ensure first de-reference the recordset in other controls and then close the recordset.
example:
WHEN ( btn1:baction := nil, btn2:baction := nil, ...... , oRs:Close(), .t. )
This can happen with DBF also.
Re: bug xBrowse ADO
Posted: Tue Jul 07, 2015 8:23 am
by MOISES
Dear Mr. Nages,
Thank you for your attention.
The xBrowse is placed in a Windows, not the main one.
I use StopUntill to simulate a Dialog.
This is how I close it:
Code: Select all | Expand
//
// Activamos ventana
//===========
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT ( oBrowse:SetFocus() ) ;
VALID ( lExit := .T. )
StopUntil( { || lExit } )
SysRefresh()
oMenuFont:End()
oMainFont:End()
oRs:Close()
oRs := Nil
I close it at the end. So I don´t know what is wrong.
In my PC, it works fine, no error arrises.
Thank you.
Re: bug xBrowse ADO
Posted: Tue Jul 07, 2015 12:55 pm
by Rick Lipkin
MOISES
Remove the SysRefresh() and re-try your code ..
Rick Lipkin