I´m changing the browse of all my apps to use xbrowse. One of them use ADO to connect to a MS-SQL database. The folowing code works OK:
LOCAL oRs := HB_AdoRddGetRecordSet()
IF PegaData( @dData )
IF !empty( dData )
oRs:Filter := "data_release = '" + dToC( dData ) + "'"
ELSE
oRs:Filter := NIL
ENDIF
IF oRs:RecordCount > 0
DEFINE DIALOG oDlgs RESOURCE "SELECAO" OF wndMain()
REDEFINE LISTBOX oLbx FIELDS oRs:Fields( 1 ):Value, subStr( oRs:Fields( 2 ):Value, 1, 75 ) HEADERS "DATA", "TÍTULO" ;
SIZES 80,200 ID 103 OF oDlgs ON DBLCLICK( DigitaAlte( oRs ), oLbx:refresh() ) UPDATE
oLbx:bLogicLen := { || oRs:RecordCount }
oLbx:bGoTop := { || oRs:MoveFirst() }
oLbx:bGoBottom := { || oRs:MoveLast() }
oLbx:bSkip := { | nSkip | Skipper( oRs, nSkip ) }
oLbx:cAlias := "ARRAY"
oDlgs:lHelpIcon := .f.
ACTIVATE DIALOG oDlgs
.............................................
When I change to xbrowse the filter is ignored and all the dates are displayed.
LOCAL oRs := HB_AdoRddGetRecordSet()
IF PegaData( @dData )
IF !empty( dData )
oRs:Filter := "data_release = '" + dToC( dData ) + "'"
ELSE
oRs:Filter := NIL
ENDIF
IF oRs:RecordCount > 0
DEFINE WINDOW oDlgs MDICHILD OF wndMain() TITLE "Alteração de notícia"
oLbx := TXBrowse():New( oDlgs )
oLbx:SetAdO( oRs, .t., .t., { "data_release", "titulo" } )
oLbx:aCols[ 1 ]:cHeader := "DATA"
oLbx:aCols[ 2 ]:cHeader := "TÍTULO"
oLbx:aCols[ 2 ]:nWidth := 530
oLbx:bLDblClick := { || DigitaAlte( oRs ), oLbx:refresh() }
oLbx:CreateFromCode()
oDlgs:oClient := oLbx
ACTIVATE WINDOW oDlgs ON INIT oDlgs:aControls[ 1 ]:SetFocus()
What am I doing wrong?
TIA