Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLServer Transactions
Message
De
10/08/2005 21:28:26
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
SQLServer Transactions
Divers
Thread ID:
01040065
Message ID:
01040065
Vues:
55
I have a process running from a method of my bizobj in VFE which updates or changes a number of sqlserver tables through remote views ( each controlled by a business object )

I would like to wrap the entire process in a sqlserver transaction and control it manually, rather than use VFP transactions.

I have turned off all begin trans - end trans calls in my framework objects

This is the controlling method
	nhandle=This.oapplication.iconnecthandle

*!*		lnresult=SQLSETPROP(nhandle,"Transactions",2)
* this line shows nothing in profiler so I am using the line below

	lnresult=SQLEXEC(nhandle,'set implicit transactions off')
	lnresult=SQLEXEC(nhandle,'BEGIN TRANSACTION')
* both lnresults are 1 and I see both commands in the profiler

* after following two methods are run, a series of INSERT INTO
* and UPDATE statements are seen in the profiler
* they are interspersed with exec sp_executesql N'SELECT ... 
* statements as the three remote views in the process are reparamed and requeried
* is that what is hosing my transaction?

	llsuccess=This.process_rows()

	llsuccess=This.create_audit()

* If I look in EM or QA the changes have already been made

IF llsuccess

     lncommit=SQLEXEC(nhandle,'COMMIT TRANSACTION')

* returns 1  
* command seen in profiler 

ELSE
	lnrollback = SQLEXEC(nhandle,'ROLLBACK TRANSACTION')

* returns 1 
* command seen in profiler but nothing is rolled back

ENDIF	

lnresult=SQLEXEC(nhandle,'set implicit transactions on')
If I use QA to look at @@trancount right after the begin transaction it returns 0
???

Seems that if that is the case the rollback should return something other than 1.

Obviously I am confused.

Insights appreciated

TIA, Sergey ;-)


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform