-
1
- #1
Hi to all.
do you want an errorlog ?
try this
ON ERROR DO errhand IN errutil ;
WITH SYS(0), ERROR(), MESSAGE(), MESSAGE(1), ;
PROGRAM(), LINENO(1), DBF(), DATE(), TIME()
* End of error trap setup.
PROCEDURE errhand
PARAMETER m.machine, m.messgnum, m.messg, m.linecode, ;
m.callprog, m.inline, m.OPENTABL, m.errdate, ;
m.errtime
m.errspace=SELECT() && Store current work area.
m.errorder=ORDER() && Store current order.
IF LEN(ALLTRIM(m.callprog))=0
m.callprog="Command Line"
STORE SPACE(0) TO m.linecode
ENDIF
outmsgline="Error ; "+m.messg+CHR(13)+"Line "+STR(m.inline)+ ;
CHR(13)+ ;
"program name = "+m.callprog+CHR(13)+"Syntax is :"+m.linecode
* Visual FoxPro users use =MESSAGEBOX(outmsgline,32+0)
* MAC uUse the FXALERT() Function in Foxtools.mlb
* FoxPro For Windows users use the MsgBox() Function in Foxtools.fll
WAIT WINDOW outmsgline TIMEOUT 5 && All versions can use this syntax.
IF !USED("ERRORLOG"
IF FILE("ERRORLOG.DBF"
SELECT 0
USE errorlog
ELSE
SELECT 0
thisversion=VERSION()
IF LEFT(ALLTRIM(thisversion),6)="Visual"
* Create Free table for Visual FoxPro Versions
CREATE TABLE errorlog FREE (machine c(20), messgnum N(4,0), ;
messg c(70), linecode c(70), callprog c(40), ;
inline N(6,0), OPENTABL c(25), errdate d, errtime c(8))
ELSE
CREATE TABLE errorlog (machine c(20), messgnum N(4,0), ;
messg c(70), linecode c(70), callprog c(40), ;
inline N(6,0), OPENTABL c(25), errdate d, errtime c(8))
ENDIF
ENDIF
ENDIF
INSERT INTO errorlog FROM MEMVAR
SELECT errorlog && Select errorlog table.
USE && Close errorlog table.
SELECT (m.errspace) && Return to stored work area.
IF !EMPTY(ALIAS())
SET ORDER TO (m.errorder)
ENDIF
RELEASE ALL LIKE m.messgnum, m.messg, m.linecode, m.callprog, ;
m.inline
RETURN
do you want an errorlog ?
try this
ON ERROR DO errhand IN errutil ;
WITH SYS(0), ERROR(), MESSAGE(), MESSAGE(1), ;
PROGRAM(), LINENO(1), DBF(), DATE(), TIME()
* End of error trap setup.
PROCEDURE errhand
PARAMETER m.machine, m.messgnum, m.messg, m.linecode, ;
m.callprog, m.inline, m.OPENTABL, m.errdate, ;
m.errtime
m.errspace=SELECT() && Store current work area.
m.errorder=ORDER() && Store current order.
IF LEN(ALLTRIM(m.callprog))=0
m.callprog="Command Line"
STORE SPACE(0) TO m.linecode
ENDIF
outmsgline="Error ; "+m.messg+CHR(13)+"Line "+STR(m.inline)+ ;
CHR(13)+ ;
"program name = "+m.callprog+CHR(13)+"Syntax is :"+m.linecode
* Visual FoxPro users use =MESSAGEBOX(outmsgline,32+0)
* MAC uUse the FXALERT() Function in Foxtools.mlb
* FoxPro For Windows users use the MsgBox() Function in Foxtools.fll
WAIT WINDOW outmsgline TIMEOUT 5 && All versions can use this syntax.
IF !USED("ERRORLOG"
IF FILE("ERRORLOG.DBF"
SELECT 0
USE errorlog
ELSE
SELECT 0
thisversion=VERSION()
IF LEFT(ALLTRIM(thisversion),6)="Visual"
* Create Free table for Visual FoxPro Versions
CREATE TABLE errorlog FREE (machine c(20), messgnum N(4,0), ;
messg c(70), linecode c(70), callprog c(40), ;
inline N(6,0), OPENTABL c(25), errdate d, errtime c(8))
ELSE
CREATE TABLE errorlog (machine c(20), messgnum N(4,0), ;
messg c(70), linecode c(70), callprog c(40), ;
inline N(6,0), OPENTABL c(25), errdate d, errtime c(8))
ENDIF
ENDIF
ENDIF
INSERT INTO errorlog FROM MEMVAR
SELECT errorlog && Select errorlog table.
USE && Close errorlog table.
SELECT (m.errspace) && Return to stored work area.
IF !EMPTY(ALIAS())
SET ORDER TO (m.errorder)
ENDIF
RELEASE ALL LIKE m.messgnum, m.messg, m.linecode, m.callprog, ;
m.inline
RETURN