Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ciprian Zaharia
  Where is Ciprian Zaharia?
 Ciprian Zaharia
 To: Leslie Sy
  Where is Leslie Sy?
 Leslie Sy
Subject: RE: transaction
Thread ID: 416039 Message ID: 416051 # Views: 48 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Windows 7 and VFP
Date: Friday, December 19, 2014 9:27:19 PM         

> * I did not commit the transaction and I just close it! why is it in my database?
> cSErver = "some_ip\SQLEXPRESS"
> cDAtabase = "some_db"
> cUserID = "some_user"
> cPAssword = "some_pwd"
> con_handle = SQLStringConnect("Driver={SQL Server};Server="+cSErver+";Database="+cDAtabase+";Uid="+cUserID+";Pwd="+cPassword+";")
> SQLSETPROP(con_handle, "Transactions", 2)
> SQLEXEC(con_handle, "Insert Into Test (name) values ('some_val')")
> SQLDISCONNECT(con_handle)

It is not specified in VFP but I found this


Terminates a successful connection. DISCONNECT automatically executes a COMMIT to guarantee that all changes made to the database since the beginning of the current unit of work are committed.

If AutoCommit is false, a COMMIT TRANSACTION executes automatically to guarantee that all changes made to the database since the beginning of the current logical unit of work are committed.

at this address

So it is clear if there is no error SQLDISCONNECT is doing a commit

Ciprian Zaharia


transaction Posted by Jaime Mantala @ 12/19/2014 9:04:59 AM
RE: transaction Posted by Ciprian Zaharia @ 12/19/2014 9:27:19 PM