Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLSERVER Rollback
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
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:
01665066
Views:
81
Hi,
=SQLSETPROP(m.con,"Transaction",2 ) && DB_TRANSMANUAL - see to help

TEXT TO mqry noshow
SELECT * FROM stop1 WITH (tablockx)
ENDTEXT
=SQLExec(m.con,mqry)

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)
   =SQLROLLBACK(m.con)
   Messagebox(laerror[1,2])
ELSE
   =SQLCOMMIT(m.con)
   Messagebox("Invoice Saved",0+64,"System",3000)
Endif
MartinaJ

>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.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform