oRs := CREATEOBJECT( "ADODB.Recordset" )
cSQL := "SELECT * FROM Articoli ORDER BY codice ASC"
TRY
oRs:Open( cSQL, oConnection, adOpenStatic, adLockOptimistic ) // 3, 3
CATCH oError
MsgStop(oError:Operation+CRLF+oError:Description,"Ado Connection")
RETURN NIL
END TRY
DEFINE TIMER oTimer;
INTERVAL 1000;
ACTION ( nTimer++, IIF( nTimer > 10, RefreshSQL( @nTimer, oTimer, oRs, oBrw ), "" ) ) OF oDlg
ACTIVATE TIMER oTimer
oTimer:deActivate()
DEFINE DIALOG oDlg ;
FROM 7,7 to 35,104 ;
TITLE "Articoli"
@ 0, 0 LISTBOX oBrw;
FIELDS "", "", "", "", "";
HEADERS "Codice", "Descrizione", "Desc. Aggiuntiva", "Nota 1", "Nota 2";
OF oDlg
oBrw:bLine := { || { oRs:Fields( "codice" ):Value, oRs:Fields( "descrizione" ):Value, oRs:Fields( "descrizione_aggiuntiva" ):Value, oRs:Fields( "nota1" ):Value, oRs:Fields( "nota2" ):Value } }
oBrw:bLogicLen := { || oRs:RecordCount }
oBrw:bGoTop := { || oRs:MoveFirst() }
oBrw:bGoBottom := { || oRs:MoveLast() }
oBrw:bSkip := { | nSkip | SkipperAdo( oRs, nSkip ) }
oBrw:cAlias := ""
ACTIVATE DIALOG oDlg;
ON INIT ( oDlg:SetControl( oBrw ), nSecFine:= SECONDS(), InfStat( NTRIM( nSecFine-nSecIni ) + " secondi... - " + NTRIM( oRs:RecordCount ) + " records..." ), oTimer:activate() )
oTimer:end()
TRY
oRs:Close()
CATCH
END TRY
TRY
oConnection:Close()
CATCH
END TRY
RETURN NIL
FUNCTION RefreshSQL( nTimer, oTimer, oRs, oBrw )
LOCAL nRec := oRs:AbsolutePosition
nTimer := 0
oTimer:deActivate()
CursorWait()
TRY
oRs:Requery()
CATCH
END TRY
TRY
oRs:Move( nRec-1 )
CATCH
END TRY
oBrw:refresh()
CursorArrow()
oTimer:Activate()
RETURN NIL
oRs:Properties("Resync Command"):Value := "SELECT * FROM CERT WHERE EID = ?"
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 57 guests