Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Distributed transactions in ADO

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-27 : 11:53:57
Michael writes "Server OS : Windows 2000 Advanced Server sp2
Client OS : Windows 2000 sp2
Database : SQL Server 2000 sp2
MDAC : 2.7

I already have a client/server application that uses ADO for all its transaction handling and now I need to distribute the database schema across two linked servers.

I know that in SQL Server 2000, to start a distributed transaction I write:

SET XACT_ABORT ON
BEGIN DISTRIBUTED TRANSACTION

But what do I do if ADO is controlling the transaction?
Should Connection.BeginTrans work? It certainly doesn't seem to for me! I'm surprised that there isn't a Connection.BeginDistributedTrans method."

nr
SQLTeam MVY

12543 Posts

Posted - 2002-02-27 : 12:31:46
Connection.begintrans should create a transaction on that spid.
Check that this is the case as it didn't used to.

You now have a transaction. Any commands on that spid through the server to the linked server should automatically promote the transaction to a distributed transaction and incorporate dtc.

You should be able to just use the exec command to start a distributed transaction with the xact abort option in the scope of the spid.

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -