bug xBrowse ADO

bug xBrowse ADO

Postby MOISES » Mon Jul 06, 2015 7:56 pm

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
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug xBrowse ADO

Postby Rick Lipkin » Mon Jul 06, 2015 9:50 pm

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 view

// oWChild:bPostEnd := { || oRs1:Close(), oRs2:End() }
 
User avatar
Rick Lipkin
 
Posts: 2617
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: bug xBrowse ADO

Postby nageswaragunupudi » Mon Jul 06, 2015 11:51 pm

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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: bug xBrowse ADO

Postby MOISES » Tue Jul 07, 2015 8:23 am

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 view
  //
   // 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
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug xBrowse ADO

Postby Rick Lipkin » Tue Jul 07, 2015 12:55 pm

MOISES

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

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2617
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Rick Lipkin and 84 guests