bug xBrowse ADO

Post Reply
MOISES
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

bug xBrowse ADO

Post 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.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
Rick Lipkin
Posts: 2677
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA
Been thanked: 2 times

Re: bug xBrowse ADO

Post 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 :

Code: Select all | Expand


// oWChild:bPostEnd := { || oRs1:Close(), oRs2:End() }
 
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: bug xBrowse ADO

Post 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.
Regards

G. N. Rao.
Hyderabad, India
MOISES
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug xBrowse ADO

Post 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.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
Rick Lipkin
Posts: 2677
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA
Been thanked: 2 times

Re: bug xBrowse ADO

Post by Rick Lipkin »

MOISES

Remove the SysRefresh() and re-try your code ..

Rick Lipkin
Post Reply