Hola Gustavo
Para mostrar una fila se detecta la cantidad de registros que existe en la fuente de datos
sea Array, DBFs, ADO, etc y evaluara el codeblock encargado para pintar las filas
solo se pintaran las lineas y columnas visibles, nada mas
si puedes hacer un xBrowse con un array vacio, el punto esta en especificar la cantidad de columnas que tendra el array,
los datos deben ser consistentes para la configuracion del xBrowse es necesaria esa informacion para configurar internamente el xBrowse
El Sr Rao ha hecho muchas mejoras a la clase no sabria decirte hasta donde ha llegado con este punto...
con respecto al record set, tambien puedes hacer un xbrowse con un RS vacio
te dejo ejemplo de ambos, el ejemplo de ADO esta funcional, usa la base de datos ejemplos de TDolphin
Array
Descagra EXE
http://www.sitasoft.net/fivewin/samples/array1.zip- Code: Select all Expand view
#include "fivewin.ch"
#include "xbrowse.ch"
function main()
local oWnd
local oBrw
local aArray := {}
define window oWnd
@ 0, 0 xbrowse oBrw array aArray;
columns 1, 2, 3, 4;
headers "Column 1", "Column 2", "Column 3", "Column 4"
oBrw:CreateFromCode()
oWnd:oClient = oBrw
activate window oWnd
return nil
Descarga EXE
http://www.sitasoft.net/fivewin/samples/ado1.zip- Code: Select all Expand view
#include "fivewin.ch"
#include "adordd.ch"
#include "xbrowse.ch"
PROCEDURE Main()
LOCAL cTime := time()
LOCAL oServer
LOCAL oRs
IF ( oServer := ConnectTo() ) != NIL
DoBrowse( oServer )
ENDIF
RETURN
//-----------------------------------------//
function DoBrowse( oServer )
local oWnd
local oBrw
local oRS
oRS = RecSet( oServer )
define window oWnd
@ 0, 0 xbrowse oBrw object oRS
oBrw:CreateFromCode()
oWnd:oClient = oBrw
activate window oWnd
return NIL
FUNCTION RecSet( oServer )
LOCAL oRS, oError, cQry
TRY
oRS = TOleAuto():new( "ADODB.RecordSet" )
CATCH oError
? "Init RecordSet Failed!!!"
ShowError( oError )
RETURN NIL
END
cQry = "SELECT * FROM president limit 0"
oRS:cursorLocation = adUseClient
oRS:lockType = adLockOptimistic
oRS:cursorType = adOpenDynamic
oRS:source = cQry
oRS:activeConnection = oServer
TRY
oRS:open()
CATCH oError
? "Build RecordSet Failed!!!"
ShowError( oError )
RETURN NIL
END
return oRS
//-----------------------------------------//
PROCEDURE GetError( oServer, nError, lInternal )
LOCAL cText := ""
cText += "Error from Custom Error Message" + CRLF
cText += "================================" + CRLF
cText += oServer:ErrorTxt() + CRLF
cText += "ERROR No: " + Str( nError ) + CRLF
cText += "Internal: " + If( lInternal, "Yes", "No" ) + CRLF
? cText + CRLF
RETURN
//-----------------------------------------//
FUNCTION ConnectTo()
LOCAL oServer := NIL
LOCAL cServer
LOCAL cUser
LOCAL cPassword
LOCAL nPort
LOCAL cDBName
LOCAL nFlags
LOCAL oErr
LOCAL cConString
LOCAL lRet := .T.
cServer := "dolphintest.sitasoft.net"
cUser := "test_dolphin"
cPassword := "123456"
nPort := "3306"
cDBName := "dolphin_man"
nFlags := 0
cConString := "Driver={MySQL ODBC 5.1 Driver}" + ;
";Server=" + cServer + ;
";DefaultDatabase=" + cDBName + ;
";Database=" + cDBName + ;
";Port=" + nPort + ;
";User=" + cUser + ;
";Password=" + cPassword + ;
";Option=3;"
TRY
oServer := TOleAuto():New( "ADODB.Connection" )
CATCH oErr
? "Init Server Failed!!!"
ShowError( oErr )
RETURN NIL
END
oServer:ConnecTionString := cConString
TRY
oServer:Open()
CATCH oErr
? "Conection Server Failed!!!"
ShowError( oErr )
RETURN NIL
END
RETURN oServer
//-----------------------------------------//
FUNCTION ShowError( oError )
local cError := ""
cError += " Descripción : " + oError:Description
cError += " SubSystem : " + oError:SubSystem
cError += " Error Number : " + Str( oError:SubCode )
cError += " Severity : " + Str( oError:Severity )
RETURN NIL