Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with TABLEUPDATE
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00720907
Message ID:
00721663
Views:
9
Sorry - what I said was the update is the replace method - this is the update method
LOCAL aTables(1,2), intTables, intLoop, bolSuccess, strPath
intTables = AUSED(aTables) && count tables open in this datasession
IF intTables < 1 THEN 
	RETURN .f. && no tables open to update
ENDIF 

*************************************************************************************
* used this code for debugging purposes
*************************************************************************************
*!*	SET MULTILOCKS ON
*!*	CURSORSETPROP("Buffering", 5, "sysoptions") && set optimistic row buffering on
*!*	LIST STATUS TO D:\vfp8projects\datahub\errors\comstatus.txt
*!*	intNo = CURSORGETPROP("Buffering", "sysoptions")
*!*	strPath = SYS(5) + SYS(2003)
*!*	* STRTOFILE(STR(intNo), "c:\com1.txt") 
*!*	SET DEFAULT TO D:\vfp8projects\datahub\errors\
*!*	IF FILE('com.txt')  && Does file exist? 
*!*	   gnTextFile = FOPEN('com.txt', 12)     && If so, open read/write
*!*	ELSE
*!*	   gnTextFile = FCREATE('com.txt', 0)  && If not create it
*!*	ENDIF
*!*	IF gnTextFile < 0     && Check for error opening file
*!*	   
*!*	ELSE  && If no error, write to file
*!*	   =FWRITE(gnTextFile , 'Table buffering = ' + STR(intNo))
*!*	ENDIF
*!*	=FCLOSE(gnTextFile )     && Close file
*!*	SET DEFAULT TO (strPath)
*************************************************************************************

BEGIN TRANSACTION && start transaction process
FOR intLoop = 1 TO intTables 
	bolSuccess = TABLEUPDATE(1, .f., aTables(intLoop, 1)) && update tables
	IF NOT bolSuccess THEN && if not successful update rollback and revert 
		ROLLBACK 
		thisform.mrevert() && revert all updates
		EXIT && failed on an update so don't bother with the rest
	ENDIF 
ENDFOR 
IF bolSuccess THEN 
	END TRANSACTION && if all tables successfully updated end the transaction
ENDIF
RETURN bolSuccess && return success or failure
Sorry about that!
Chris Maiden
Email
Web
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform