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?
 Brossard
 Canada
 Ciprian Zaharia
 To: Leslie Sy
  Where is Leslie Sy?
 Makati
 Philippines
 Leslie Sy
 Tags
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

DISCONNECT

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
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc37776.1250/html/connpb/Microsoft_SQL_Server_Using_CONNECT_COMMIT_DISCONNECT.htm

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

Ciprian Zaharia
Fox4Ever
http://www.visitmix.com/Opinions/Why-Does-Your-Code-or-Design-Suck
http://genn.org/stuff/tastes/

ENTIRE THREAD

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