oCatalogo:= oServer:Query( "SELECT * FROM catalogo ORDER BY codicont" )
oCatalogo:Gotop()
If oCatalogo:LastRec() != 0
oQuery:= oServer:Query( "SELECT * FROM catalogo WHERE CHAR_LENGTH(TRIM(codicont)) = '"+cvaltochar(LEN(NIV1))+"' ORDER BY codicont" )
While !oQuery:eof()
aadd(cItems,alltrim(oQuery:Codicont)+" "+oQuery:nombre)
oQuery:Skip()
Enddo
oQuery:End()
Else
MsgInfo("No hay registros en el catalogo")
Endif
REDEFINE ComboBox oCbx VAR cVar ID 109 OF oDlg ITEMS cItems ;
ON CHANGE ( oCatalogo:=oServer:Query("SELECT * FROM catalogo WHERE codicont LIKE '"+substr(cVar,1,len(NIV1))+"%' ORDER BY codicont;") ,;
oLbx:SetMySql(oCatalogo,.f.),;
oCatalogo:Refresh(),;
oLbx:Refresh() )
...
EXTEND CLASS TDOLPHINQRY WITH METHOD FillDbf
...
FUNCTION FillDbf( cTable, cAlias, bOnStart, bOnEnd )
LOCAL Self := HB_QSelf()
LOCAL lCreated := FALSE
LOCAL aStructure := {}
LOCAL x, cOldAlias := Alias()
DEFAULT cTable := "SQLRESULT", cAlias := cTable, bOnStart := {|| NIL }, bOnEnd := {|| NIL }
Eval( bOnStart, Self )
IF SELECT( cAlias ) > 0
(cAlias)->( DBCloseArea() )
ENDIF
nCountF := ::FCount()
FOR x := 1 TO nCountF
AAdd( aStructure, { ::FieldName(x), ::FieldType(x), ::FieldLen(x), FieldDec(x) } )
NEXT
TRY
DBCreate( cTable, aStructure, "DBFCDX", TRUE, cAlias )
::GoTop()
DO WHILE !::Eof()
(cAlias)->( DBAppend() )
FOR x := 1 TO nCountF
(cAlias)->( FieldPut(x, ::FieldGet(x) ) )
NEXT
::Skip()
ENDDO
::GoTop()
(cAlias)->( DBGoTop() )
lCreated := TRUE
CATCH
IF SELECT( cAlias ) > 0
(cAlias)->( DBCloseArea() )
ENDIF
lCreated := FALSE
END
IF !Empty(cOldAlias)
DBSelectArea( cOldAlias )
ENDIF
Eval( bOnEnd, Self )
RETURN lCreated
...
TRY
oQryClie := oServer:Query2( "SELECT NUM_CLIE, NOMBRE FROM CLIENTES WHERE NUM_RUTA=%1", { nRutaActual } )
oQryClie:FillDBF( "CLIE", "CLIE" ) //
oQryClie:END()
CATCH oError
ShowError( oError, { oQryClie } )
RETURN
END
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 48 guests