Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RollBack transaction doesn't work
Message
De
24/11/2009 11:01:41
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01436291
Message ID:
01436372
Vues:
67
>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()
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform