Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RollBack transaction doesn't work
Message
From
24/11/2009 11:01:41
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01436291
Message ID:
01436372
Views:
61
>Did you configure ODBC connection for manual transactions?
Hi, Sergey...

Very thinks for replying

When I use this string connection the transaction work so fine
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=mypassword;Initial Catalog=mydatabase;Data Source=myserver

When I use this string connection the transaction dont work
Driver={SQL Native Client};Server=myserver;Database=mydatabase;Uid=sa;Pwd=mypassword

I am using SQL Express
Local loConn as "ADODB.Connection"
Local loCmd  as "ADODB.Command"
Local loRs   as "ADODB.Recordset"
Local lsString as String
***
loConn = CreateObject("ADODB.Connection")
loCmd  = CreateObject("ADODB.Command")
* with this COMENTED line the transaction work
* loConn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=mypassword;Initial Catalog=mydatabase;Data Source=myserver"
* with this ACTIVE line the DONT transaction work
loConn.ConnectionString = "Driver={SQL Native Client};Server=myserver;Database=mydatabase;Uid=sa;Pwd=mypassword;"
loConn.Open()
loCmd.ActiveConnection = loConn
loCmd.CommandText = "BEGIN TRANSACTION mydatabase"
loRs = loCmd.Execute()
loCmd.CommandText = "Update mytable set myfield = 45 where mykey = 289880"
loRs = loCmd.Execute()
loCmd.CommandText = "ROLLBACK TRANSACTION mydatabase"
loRs = loCmd.Execute()
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform