- Code: Select all Expand view RUN
#include "FiveWin.ch"
#include "xBrowse.ch"
STATIC oWnd
//-------------------------------------------------------------------------------------
Function Main()
SET EPOCH TO 1920
SET DATE FORMAT "dd/mm/yyyy"
SET WRAP ON
REQUEST DBFCDX
If !Conectar()
Return Nil
Endif
maestro()
Return Nil
//-----------------------------------------------------------------------------
Function conectar()
Local Retorno:=.F.
LOCAL oErr,oCs
Public oCn
TRY
oCn:= CreateObject( "ADODB.Connection" )
oCs:= "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=ecst06; UID=root; PWD=10157763"
oCn:Open(oCs)
Retorno:=.T.
CATCH oErr
MSGAlert( "Error: " + oErr:Operation + " -> " + oErr:Description )
Retorno:=.F.
END
Return Retorno
Function maestro()
local oBrw
Local cSelect:= "select maestro.FECASI, maestro.ASIENTO, maestro.DESCASI, maestro.TOTDEB, maestro.TOTHAB from maestro"
oDbDet:=TAdoBase():New( oCn, "maestro", cSelect )
DEFINE WINDOW oWnd FROM 1, 1 TO 700,950 PIXEL TITLE "prueba adobase"
oBrw := TXBrowse():New( oWnd )
oBrw:nTop := 20
oBrw:nLeft := 10
oBrw:nBottom := 650
oBrw:nRight := 900
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:nHeaderLines := 2
oBrw:nFooterLines := 2
oBrw:nDataLines := 1
oBrw:lColDividerComplete := .T.
oBrw:lFooter := .t.
oBrw:cToolTip = "Este es el poder del xBrowser de fwh"
oBrw:SetAdo(oDbDet:oRcs)
oBrw:CreateFromCode()
ACTIVATE WINDOW oWnd
oDbDet:Close()
RETURN NIL
[quote]
Como hago para indicarle cuales son las columnas que quiero es decir
[/quote]
include "Report.ch"
#include "FiveWin.ch"
#include "xBrowse.ch"
STATIC oWnd
//-------------------------------------------------------------------------------------
Function Main()
SET EPOCH TO 1920
SET DATE FORMAT "dd/mm/yyyy"
SET WRAP ON
REQUEST DBFCDX
If !Conectar()
Return Nil
Endif
maestro()
Return Nil
//-----------------------------------------------------------------------------
Function conectar()
Local Retorno:=.F.
LOCAL oErr,oCs
Public oCn
TRY
oCn:= CreateObject( "ADODB.Connection" )
oCs:= "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=ecst06; UID=root; PWD=10157763"
oCn:Open(oCs)
Retorno:=.T.
CATCH oErr
MSGAlert( "Error: " + oErr:Operation + " -> " + oErr:Description )
Retorno:=.F.
END
Return Retorno
Function maestro()
local oBrw
Local cSelect:= "select maestro.FECASI, maestro.ASIENTO, maestro.DESCASI, maestro.TOTDEB, maestro.TOTHAB from maestro"
oDbDet:=TAdoBase():New( oCn, "maestro", cSelect )
DEFINE WINDOW oWnd FROM 1, 1 TO 700,950 PIXEL TITLE "prueba adobase"
oBrw := TXBrowse():New( oWnd )
oBrw:nTop := 20
oBrw:nLeft := 10
oBrw:nBottom := 650
oBrw:nRight := 900
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:nHeaderLines := 2
oBrw:nFooterLines := 2
oBrw:nDataLines := 1
oBrw:lColDividerComplete := .T.
oBrw:lFooter := .t.
oBrw:AddCol():bEditValue := { || oDbDet:fecasi }
oBrw:AddCol():bEditValue := { || oDbDet:asiento }
oBrw:AddCol():bEditValue := { || oDbDet:descasi }
oBrw:AddCol():bEditValue := { || oDbDet:totdeb }
oBrw:AddCol():bEditValue := { || oDbDet:tothab }
oBrw:cToolTip = "Este es el poder del xBrowser de fwh"
oBrw:SetAdo(oDbDet:oRcs)
oBrw:CreateFromCode()
ACTIVATE WINDOW oWnd
oDbDet:Close()
RETURN NIL
Este codigo trabaja bien con DBF pero con MySql y Ado, me repite siempre los valores del primer registre en todo el Browse