En este momento me surge la necesidad de actualizar o mejor dicho cambiar el recorset en tiempo de ejecución, lo estoy intentando de la siguiente manera, pero al hacer el requery, sale un error.
Cabe aclarar que la primera vez, se muestra bien, el problema surge cuando hago click sobre uno de los botones.
Code: Select all
#include "fivewin.ch"
#include "ado.ch"
function Main()
local oCnFtr, oRsFtr, oDlg, oBrw,cCnd,cQry,oError
local aSql := { "select * from tbl_empr", ;
"select * from tbl_empr WHERE e_codi='01'", ;
"select * from tbl_empr WHERE e_tipo='CONTABLE'" }
//CREAMOS UNA CONEXION PARA SOLO FACTURACION
cCnd := "DSN=dlyma;Uid=root;Pwd=secret;"
oCnFtr := FW_OpenAdoConnection( cCnd )
cQry := "USE dlyma"
TRY
oCnFtr:Execute(cQry)
CATCH oError
FW_ShowAdoError(oCnFtr)
END
oRsFtr := FW_OPENRECORDSET(oCnFtr,aSql[1],adLockOptimistic,adOpenKeyset)
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL ;
TITLE "SWITCH TABLES/FIELDS AT RUNTIME"
@ 60, 20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oRsFtr AUTOCOLS CELL LINES NOBORDER
oBrw:CreateFromCode()
@ 20, 20 BTNBMP PROMPT "sin filtro" ;
SIZE 100,35 PIXEL OF oDlg FLAT ;
ACTION ( CursorWait(), oRsFtr:Requery( aSql[ 1 ] ), oRsFtr:SetXbrColumns( oBrw ) )
@ 20,140 BTNBMP PROMPT "filtro 1" ;
SIZE 100,35 PIXEL OF oDlg FLAT ;
ACTION ( CursorWait(), oRsFtr:Requery( aSql[ 2 ] ), oRsFtr:SetXbrColumns( oBrw ) )
@ 20,260 BTNBMP PROMPT "filtro 2" ;
SIZE 100,35 PIXEL OF oDlg FLAT ;
ACTION ( CursorWait(), oRsFtr:Requery( aSql[ 3 ] ), oRsFtr:SetXbrColumns( oBrw ) )
ACTIVATE DIALOG oDlg CENTERED
oCnFtr:Close()
return nil
Code: Select all
Application
===========
Path and name: C:\fwh1909\samples\leandro.exe (32 bits)
Size: 3,862,528 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613)
FiveWin version: FWH 19.09
C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 11/16/20, 16:10:35
Error description: Error ADODB.RecordSet/6 DISP_E_UNKNOWNNAME: REQUERY
Args:
[ 1] = C select * from tbl_empr WHERE e_codi='01'
Stack Calls
===========
Called from: => TOLEAUTO:REQUERY( 0 )
Called from: leandro.prg => (b)MAIN( 36 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 704 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 990 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2030 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
Called from: leandro.prg => MAIN( 42 )