by Adolfredo Martinez » Tue Feb 19, 2019 12:07 am
Gracias por contestar.
Estoy utilizando FWH incorporado en la clase MariaDB?
Revise los ejemplos que hay en sample de maria01......maria16.
Y los soluciones asi:
#include "FiveWin.ch"
STATIC oRs,oCn
//------------------------------
function Main()
//------------------------------
local oRs, cTable, oBrw, oList, oDlg, cFile,oFont,oBar
local cServer := "127.0.0.1"
local cDataBase := "Santana"
local cUser := "root"
local cPassWord := "19585287"
local nPort := 3307
local nFlags := 0
local oCn := NIL
if oCn == nil .or. oCn:Ping() = .F.
MsgRun( "Connecting to Server", "CLOUD SERVER", ;
{ || oCn := maria_Connect( {cServer, cDataBase, cUser, cPassWord, nPort } ) } )
endif
if oCn == nil
? "Fallo la Conexion"
return nil
else
? "Conexion Exitosa"
endif
cFile = "catastro"
oRs := oCn:RowSet( cFile ) // Get fields from table
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 1050,500 PIXEL FONT oFont TITLE cFile;
GRADIENT {{ .5, CLR_BLUE, RGB(202,202,255) }, { .5, RGB(202,202,255), CLR_BLUE }}
oDlg:lHelpIcon := .f.
DEFINE BUTTONBAR oBar OF oDlg SIZE 70, 70 2010
DEFINE BUTTON OF oBar ACTION Nuevocatas(oBrw,.T.,oRs);
FILENAME "C:\fwh18.12\bitmaps\32x32\new.bmp" PROMPT "Nuevo" TOOLTIP "Nuevo"
DEFINE BUTTON OF oBar ACTION Nuevocatas(oBrw,.F.,oRs);
FILENAME "C:\fwh18.12\bitmaps\32x32\edit.bmp" PROMPT "Editar" ;
TOOLTIP "Editar"
DEFINE BUTTON OF oBar action( oDlg:End()) ;
FILENAME "C:\fwh18.12\bitmaps\32x32\exit.bmp" PROMPT "Salir" TOOLTIP "Salir de la Ventana"
@ 3,2 XBROWSE oBrw OF oDlg SIZE 500,200 ;
DATASOURCE oRs AUTOCOLS ;
CELL LINES FOOTERS NOBORDER FASTEDIT
oBrw:nStretchCol := STRETCHCOL_LAST
WITH OBJECT oBrw
:bRecSeldata := { || oBrw:KeyNo }
:nRecSelWidth := "999,999"
:bRecSelFooter := { || oBrw:nLen }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:blDblClick := { | nRow, nCol, nKey | Nuevocatas(oBrw,.T.,oRs)}
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:l2007 := .t.
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
oCn:Close()
return nil
//---------------------------------------------------------//
static function Nuevocatas( oBrw, lNuevo,oRs )
//---------------------------------------------------------//
local oDlg,lSalvar := .f.,vcodigo:=space(21),vnombre:=space(33)
local lSaved := .f.
IF lNuevo
oRs:AddNew()
ENDIF
DEFINE DIALOG oDlg SIZE 500,210 PIXEL ;
TITLE "Prueba de la Clase Fwh mariadb"
oDlg:lHelpIcon := .f.
@ 20, 20 SAY "Codigo" SIZE 50,12 PIXEL OF oDlg
@ 20, 80 GET oRs:Codigo SIZE 100,12 PIXEL OF oDlg PICTURE "@#"
@ 40, 20 SAY "Nombre" SIZE 50,12 PIXEL OF oDlg
@ 40, 80 GET oRs:nomip01 SIZE 150,12 PIXEL OF oDlg PICTURE "@!"
*
@ 80, 20 BUTTON "Save" SIZE 40,15 PIXEL OF oDlg ;
ACTION ( lSalvar := .T. , oDlg:End() )
@ 80, 80 BUTTON "Cancel" SIZE 40,15 PIXEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTER
IF lSalvar
msginfo("salvando")
msginfo(oRs:codigo,oRs:nomip01)
oRs:Save()
oRs:Refresh()
oRs:ReQuery()
oBrw:Refresh() // Repintamos el ListBox
ENDIF
RETURN(.T.)