Los datos llegan bien, porque me los devuelve correctamente, pero la visualización es erronea. Se repiten los datos mostrados.
El codigo que utilizo es el siguiente:
Code: Select all
// ODBC 32 bits access from FiveWin
#include "FiveWin.ch"
#include "Sql.ch"
static oInformacio
static lExcelInstl, lCalcInstl
static tmp
static nxlLangID, cxlTrue := "=(1=1)", cxlFalse := "=(1=0)", cxlSum, lxlEnglish := .f., hLib
static lLocked := .f.
static bXBrowse
//----------------------------------------------------------------------------//
function Main()
LOCAL oWindow
Local oInformacion
DEFINE WINDOW oWindow TITLE "FiveWin Client" MDI
SET MESSAGE OF oWindow TO "Client-Server"
DEFINE MSGITEM oInformacion OF oWindow:oMsgBar SIZE 50
ACTIVATE WINDOW oWindow ;
ON INIT odbc()
RETURN nil
function odbc()
local cNif := ""
local nStep
local odbc := TOdbc():New( "PERSONAL", "usupersonal", "XXXXXX" )
Local tdbOdbc
Local cSentencia1 := "select Nif AS DNI,rtrim(Apellidos) + ', ' + Nombre AS Nombre FROM TPersona WHERE febajact is null ORDER BY APELLIDOS "
Local oDlg, oBrw, oFont, oBar, oItem
Local aData := {}
cConsulta1 := TdbOdbc():New( cSentencia1, odbc )
DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
DEFINE DIALOG oDlg SIZE 540,240 PIXEL FONT oFont
DEFINE BUTTONBAR oBar _3D OF oDlg
DEFINE BUTTON OF oBar ACTION .T. ;
TOOLTIP "Seleccionar"
DEFINE BUTTON OF oBar ACTION oDlg:End() ;
TOOLTIP "Salir"
@ 14, 3 XBROWSE oBrw SIZE - 3,-3 PIXEL OF oDlg ;
COLUMNS "DNI","NOMBRE" ;
HEADERS 'DNI', 'Nombre' ;
PICTURES '@!', '@!' ;
ON DBLCLICK ( cNif := cConsulta1:DNI, msgstop( cNif),oDlg:End()) ;
DATASOURCE cConsulta1 CELL LINES NOBORDER
WITH OBJECT oBrw
:bOnChanged := {|| IIf( Empty( oBrw:cSeek ), oItem:SetText( oBrw:cSeek ), NIL ) }
:lHScroll := .F.
:nHeaderHeight := 36
oBrw:nStretchCol := STRETCHCOL_WIDEST
oBrw:bClrStd = {|| { CLR_BLACK, iif( oBrw:KeyNo()%2 == 0, 14220497, 16777215 ) } }
oBrw:bClrSel = {|| { CLR_WHITE, RGB(51, 102, 204) } } // REGISTRO SELECCIONADO
oBrw:lColDividerComplete := .F.
oBrw:bSeek := { |c| MySeek( cConsulta1, c, oBrw, odbc ) }
oBrw:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return cNif
//----------------------------------------------------------------------------//
FUNCTION MySeek( cConsulta1, c, oBrw, odbc )
********************************************
Local nEsta := .T.
Local cSentencia1 := "select Nif AS DNI,rtrim(Apellidos) + ', ' + Nombre AS Nombre FROM TPersona WHERE febajact is null AND Apellidos LIKE '" + upper(C) + "%' ORDER BY APELLIDOS "
cConsulta1 := TdbOdbc():New( cSentencia1, odbc )
* oBrw:ResetData( cConsulta1,{ "DNI", "Nombre" } )
oBrw:SetAdo := cConsulta1
obrw:Gotop()
oBrw:refresh()
CursorArrow()
return nEsta
Juan Jose