>Hi,
>
>Sometimes when I am debugging an application I run into a problem during one of the tables updates. And then I cannot close VFP since I am getting message:
>
>Data session #- some number - cannot be released with open transaction.
>
>So far, the only way I found to close VFP in this case is to end it in Task Manager.
>
>Is there a command I can issue in the Command window to release the transactions?
>
>TIA.
I used to run this to "Clean things up"
A simple DO Z and you are ready to go.
local lcCurDir
PUBLIC glDEBUG
wait wind nowa "Resetting developer environment..."
CloseDataAll()
on shutdown
clear program()
clear program
clear events
clear read all
clear all
close all
clear macros
clear menu
clear window
clear
set library to
set classlib to
set procedure to
on key
on error
on escape
set help to
set clock status
set status bar on
lcCurDir = sys(5) + sys(2003)
modi wind screen title lcCurDir + " - " + vers()
_screen.fontname = "Courier New"
_screen.fontsize = 10
_screen.fontbold = .T.
set defa to &lcCurDir
set century on
set debug on
set deleted off
set escape on
set exact off
set hours to 24
set message to
set optimize on
set safety off
set sysmenu to default
set sysmenu on
clear
glDEBUG = .T.
return
PROCEDURE CloseDataAll
#define MAX_SESSIONS 200
LOCAL ;
lnCurrentDataSession, ;
lnCurrentWorkArea, ;
lcErrorCode, ;
laFiles[1], ;
li
PRIVATE ;
plError
plError = .F.
lcErrorCode = ON( "error")
ON ERROR plError = .T.
FOR lnCurrentDataSession = 1 TO MAX_SESSIONS
SET DATASESSION TO ( lnCurrentDataSession )
IF plError
plError = .f.
ELSE
FOR li = 1 TO TXNLEVEL()
ROLLBACK
ENDFOR
FOR lnCurrentWorkArea = 1 to AUSED( laFiles )
SELECT (laFiles[lnCurrentWorkArea])
IF CURSORGETPROP("BUFFERING") > 1
TABLEREVERT( .T.)
ENDIF
USE
plError = .F.
ENDFOR
ENDIF
ENDFOR
FLUSH
IF NOT EMPTY( lcErrorCode )
ON ERROR &lcErrorCode
ELSE
ON ERROR
ENDIF