#include "Fivewin.ch"
#include "Tcbrowse.ch"
FUNCTION MAIN()
LOCAL oRs, oErr
oRs = CREATEOBJECT( "ADODB.Recordset" )
TRY
oRs:Open( "SELECT * FROM T_Utenti ORDER BY Utente", "Provider=SQLOLEDB;Integrated Security=SSPI;Data Source=EMAG\Emag;Initial Catalog=Quadro", 1, 3 )
CATCH oErr
? oErr:Description
RETURN NIL
END TRY
WBROWSERECORDSET( oRs )
TCBROWSERECORDSET( oRs )
oRs:Close()
RETURN NIL
STATIC FUNCTION WBROWSERECORDSET( oRs )
LOCAL oDlg, oBrw
DEFINE DIALOG oDlg SIZE 300, 300
@ 0, 0 LISTBOX oBrw FIELDS oRs:Fields( "Utente" ):Value;
HEADERS "UTENTI";
ON RIGHT CLICK oBrw:Report( "TWBrowse report", .T. )
oBrw:bLogicLen = { || oRs:RecordCount }
oBrw:bGoTop = { || oRs:MoveFirst() }
oBrw:bGoBottom = { || oRs:MoveLast() }
oBrw:bSkip = { | nSkip | Skipper( oRs, nSkip ) }
oBrw:cAlias = "ARRAY"
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
RETURN NIL
STATIC FUNCTION TCBROWSERECORDSET( oRs )
LOCAL oDlg, oBrw, oCol
DEFINE DIALOG oDlg SIZE 300, 300
@ 0, 0 BROWSE oBrw;
ON RIGHT CLICK oBrw:Report( "TCBrowse report", .T. )
ADD COLUMN TO oBrw;
DATA oRs:Fields( "Utente" ):Value;
HEADER "UTENTI";
COLOR CLR_RED, CLR_GREEN
ADD COLUMN TO oBrw;
DATA oRs:Fields( "Utente" ):Value;
HEADER "UTENTI";
COLOR CLR_RED, CLR_GREEN
oBrw:lCellStyle = .T.
oBrw:bLogicLen = { || oRs:RecordCount }
oBrw:bGoTop = { || oRs:MoveFirst() }
oBrw:bGoBottom = { || oRs:MoveLast() }
oBrw:bSkip = { | nSkip | Skipper( oRs, nSkip ) }
oBrw:cAlias = "ARRAY"
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
RETURN NIL
STATIC FUNCTION SKIPPER( oRs, nSkip )
LOCAL nRec := oRs:AbsolutePosition
oRs:Move( nSkip )
IF oRs:EOF; oRs:MoveLast(); ENDIF
IF oRs:BOF; oRs:MoveFirst(); ENDIF
RETURN oRs:AbsolutePosition - nRec
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 54 guests