Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLSERVER Rollback
Message
From
03/01/2019 03:14:42
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQLSERVER Rollback
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01665065
Message ID:
01665065
Views:
76
Dear Experts,

I am using these codes, which are working fine
TEXT TO mqry noshow
	BEGIN TRANSACTION
	SELECT * FROM stop1 WITH (tablockx)
ENDTEXT
	SQLExec(m.con,mqry)

Error_found=.f. && variable to detect error

TEXT TO m.cmd NOSHOW

INSERT INTO cash_sumt(vou_no,date) values(?thisform.text1.value,
?Thisform.text3.value)
		ENDTEXT

		If SQLExec(m.con,cmd)<0
			Aerror(laerror)
			Messagebox(laerror[1,2])
			Error_found =.T.
		Endif


		If Error_found =.F.	&& No error found

			TEXT TO mqry noshow
			commit transaction
			ENDTEXT
			SQLExec(m.con,mqry)
			Messagebox("Invoice Saved",0+64,"System",3000)

               Else
                      && how to use rollback here if error found

		Endif
Please help me how to use Rollback if any error comes.
Next
Reply
Map
View

Click here to load this message in the networking platform