by fsandoval » Tue Mar 07, 2006 9:36 pm
Local Ors, Obrw, oDlg
oRs = CREATEOBJECT( "ADODB.Recordset" )
TRY
oRs:Open( "SELECT * FROM EMPRESAS ORDER BY NUMCIA", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=comandas;UID=root;PWD=root;OPTION=1;" )
CATCH oErr
? oErr:Description
RETURN NIL
END TRY
// oInspect( oRecSet)
//Inspector( oRdd , "oRdd")
DEFINE FONT oFontBrw Name "Ms Sans Serif" SIZE 0,-11
//DEFINE DIALOG oDlg RESOURCE "DLGMANDB" FONT oFontBrw
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( "NomCia" ):Value;
HEADER "UTENTI";
COLOR CLR_RED, CLR_GREEN
ADD COLUMN TO oBrw;
DATA oRs:Fields( "DirCia" ):Value;
HEADER "UTENTI";
COLOR CLR_RED, CLR_GREEN
oBrw:bLogicLen = { || oRs:RecordCount }
oBrw:bGoTop = { || oRs:MoveFirst() }
oBrw:bGoBottom = { || oRs:MoveLast() }
oBrw:bSkip = { | nSkip | Skipper( oRs, nSkip ) }
oBrw:cAlias = "ARRAY"
// oDlg:oClient:=oBrw
// oDlg:SetControl( oBrw )
// oBrw:lCellStyle := .T. // Solo para FW 2.00 ¢ superior
// oBrw:nLineStyle := 3 // Solo para FW 2.00 ¢ superior
// oBrw:Refresh()
/*
REDEFINE BUTTON oBAltas ID 202 OF oDlg ;
ACTION (AltasCias( ID_AALT, oRecSet ) ,SelEmpresa(oWnd, oRecSet ), oRecSet:Refresh(.t.),oBrw:Refresh() , oRecSet:End() ,oDlg:End() , SysRefresh() )
REDEFINE BUTTON oBModificar ID 203 OF oDlg ;
ACTION AltasCias( ID_AMOD, oRecSet )
REDEFINE BUTTON oBBorrar ID 204 OF oDlg ;
ACTION ( if( MsgYesNo( OemToAnsi( ;
"¨Seguro que quiere borrar la Empresa " + oRecSet:Fields("NumCia"):value ) ) , ;
BorrarRegistro(oAdo , "empresas" , "numemp" , oRecSet:Fields("NumCia"):value ) , "" ) , oRecSet:refresh() )
REDEFINE BUTTON oBSeleccion ID 201 OF oDlg ;
ACTION (SelEmpresa(oWnd , oRecSet ), SysRefresh() ,oDlg:End())
REDEFINE BUTTON oBSalir ID 206 OF oDlg ;
ACTION ( oTb:Close(), oDlg:End())
*/
ACTIVATE DIALOG oDlg ;
ON INIT oDlg:SetControl( oBrw ) ;
CENTER
oFontBrw:End()
RETURN( NIL )