Tengo un pequeño problema con este código que os pongo abajo. El problema consiste en que una vez mostrado el Browse al mover el cursor aparece el siguiente mensaje de error :
Code: Select all
Application
===========
Path and name: D:\ProADO\Wconta\GCONTA.Exe (32 bits)
Size: 905,728 bytes
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 9445)
FiveWin Version: FWHX 12.06
Windows version: 6.1, Build 7600
Time from start: 0 hours 0 mins 24 secs
Error occurred at: 20-05-2015, 13:07:05
Error description: Error ADODB.RecordSet/6 DISP_E_UNKNOWNNAME: RECORDCOUNT
Args:
Stack Calls
===========
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETADO( 4282 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1384 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1253 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11649 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3154 )
Called from: => SYSREFRESH( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:END( 511 )
System
======
El código es este
Code: Select all
Local cSource1 := "SELECT * FROM DIARIO ORDER BY ASIENTO"
Local cSource2 := "SELECT * FROM CONCEPTO ORDER BY CODIGO"
Local cSource3 := "SELECT * FROM CUENTAS ORDER BY CUENTA"
Local aRowGrad,aSelGrad ,aCampos
Private oRsDiario, oRsCta, oRsCpto
oBarMain:Disable()
oMenu:Disable()
oRsDiario := FW_OPENRECORDSET(oConex,cSource1,3)
oRsCpto := FW_OPENRECORDSET(oConex,cSource2,3)
oRsCta := FW_OPENRECORDSET(oConex,cSource3,3)
If oRsDiario:RecordCount() > 1
oRsDiario:MoveLast()
EndIf
aRowGrad := { { .5, RGB( 232, 241, 252 ), RGB( 232, 241, 252 ) }, ;
{ .5, RGB( 210, 225, 244 ), RGB( 235, 243, 253 ) } }
aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
{ .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
AFILL(aSumas,0)
aCampos := {oRsDiario:Fields(0):Name, oRsDiario:Fields(1):Name, ;
oRsDiario:Fields(2):Name, oRsDiario:Fields(3):Name, ;
oRsDiario:Fields(4):Name, oRsDiario:Fields(5):Name, ;
oRsDiario:Fields(6):Name, oRsDiario:Fields(7):Name,"." }
DEFINE FONT oFontCli NAME "TAHOMA" SIZE 0, -13
DEFINE WINDOW oWChild MDICHILD NOSYSMENU;
TITLE "Diario Contable" OF oWMain
SET FONT OF oWChild TO oFontCli
SET MESSAGE OF oWChild TO "DIARIO CONTABLE : "+cTrabajo
DEFINE BUTTONBAR oBar1 OF oWChild SIZE 80, 60 2007
DEFINE BUTTON OF oBar1 ACTION NuevoAsiento(ID_ALT,oBrw) ;
RESOURCE "NUEVAS" PROMPT "Añadir" TOOLTIP "Nuevo Asiento"
DEFINE BUTTON OF oBar1 ACTION ModAsiento(ID_MOD,oBrw) ;
RESOURCE "EDITAR" PROMPT "Editar" TOOLTIP "Editar Asiento"
DEFINE BUTTON OF oBar1 ACTION (BorrAsiento(),oBrw:Refresh()) ;
RESOURCE "BORRAR" PROMPT "Borrar" TOOLTIP "Borrar Asiento"
* DEFINE BUTTON OF oBar1 ACTION (Ordenar(oDiario,oWchild,"DIAR"),oLbx:Refresh()) ;
* RESOURCE "ORDENAR" PROMPT "ORDENAR" TOOLTIP "Ordenar Asientos"
* DEFINE BUTTON OF oBar1 ACTION Buscasientos(oBrw,cAlias,oWChild) ;
* RESOURCE "BUSCAR" PROMPT "Buscar" TOOLTIP "Buscar en Asiento"
DEFINE BUTTON OF oBar1 ACTION oWChild:End() ;
RESOURCE "Salir" PROMPT "Salir" TOOLTIP "Salir de esta pantalla"
oBrw := TXBrowse():New( oWChild )
oBrw:SetAdo( oRsDiario, .T.,.T.,aCampos)
WITH OBJECT oBrw
:lColDividerComplete := .t.
:nMarqueeStyle := 3
:nColDividerStyle := 1
:nHeaderLines := 2
:lFooter := .t.
:nStretchCol := 9
:bClrSelFocus := { || { CLR_BLACK, aSelGrad } }
:bClrRowFocus := { || { CLR_BLACK, aRowGrad } }
:bClrStd := { || IIF(oRsDiario:AbsolutePosition % 2 == 0,{ CLR_BLACK, RGB( 224, 236, 255 ) }, { CLR_BLACK, RGB( 189, 211, 253 ) } )}
:blDClickDatas := { || ModAsiento(ID_MOD,oWChild,oBrw),oBrw:Refresh() }
:CreateFromCode()
END
* nStrechCol := nº de columna del Browse que queremos que nos ajuste desde la 1 hasta la ultima
*
oBrw:aCols[ 1]:cEditPicture := "999,999"
oBrw:aCols[ 7]:cEditPicture := "999,999.99"
oBrw:aCols[ 8]:cEditPicture := "999,999.99"
oWChild:oClient := oBrw
ACTIVATE WINDOW oWChild MAXIMIZED ;
VALID( oBarMain:Enable(),oMenu:Enable(),dbCloseAll(),.t. )
SysRefresh()
FERASE(cDiarioTmp)
RELEASE FONT oFontCli
oRsDiario:Close()
oRsCta:Close()
oRsCpto:Close()
return( nil )