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
 Development Tools
 ASP.NET
 How to execute 2 procedures on different SQL?

Author  Topic 

hornet
Yak Posting Veteran

96 Posts

Posted - 2007-06-13 : 01:29:12
Hi all!

Wanna to do next thing. I'm to execute 2 procedures on different SQL instances inside one ADO transaction.
Did anybody do this? Espessialy I'm interested how to work with ADO objects.
Thanks in advance!

rudesyle
Posting Yak Master

110 Posts

Posted - 2007-06-13 : 09:55:33
quote:
Originally posted by hornet

Hi all!

Wanna to do next thing. I'm to execute 2 procedures on different SQL instances inside one ADO transaction.
Did anybody do this? Espessialy I'm interested how to work with ADO objects.
Thanks in advance!





I've never done it, but give it a shot. Doesn't seem like it would take much code to attempt. This is what transactions are all about (making sure data arrives consistently accross all sources).
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-13 : 10:00:43
acctually it's not that simple.
you'll have to create a distributed transaction which sometimes isn't enabled etc...

your best bet is to use TransactionScope:
http://www.c-sharpcorner.com/UploadFile/mosessaur/TransactionScope04142006103850AM/TransactionScope.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

hornet
Yak Posting Veteran

96 Posts

Posted - 2007-06-13 : 13:17:50
Obviously i've written not enough clear. I meant I have in ADO.NET app (C#) (Sql objects like Conn, Cmd, Tran etc) and i'm to execute a pay(e.g.). Firstly i'm to make a pay in one Db and after that i'm to write smth in Delivery in another one. certainly i must handle process with ADO tran. So wanna to ask how to manipulate ADO objects data not being lost.
Thanks!
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-13 : 13:47:02
i doubt that you can handle this only with ado transactions alone.

what have you tried so far?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

hornet
Yak Posting Veteran

96 Posts

Posted - 2007-06-13 : 14:34:11
Attempt to explain in short-cut.
I have online reserving system where client can pay his purchases by credit card. So when client works with system before purchase he works with online system DB. But when he decides to pay smth, online system application should invoke Web-service which execute a pay by ctedit card in another DB (company of supporting credit cards). It connected with online application should know nothing about DB of another DB excluding name of Web-Service. may be u see more interesting things to implement it?
Go to Top of Page

hornet
Yak Posting Veteran

96 Posts

Posted - 2007-06-13 : 14:39:37
and forgot to say before making a pay i should to execute a proc on local DB after that execute making a pay on another DB wia Web-service and eventually to do another one proc on local. And everything connected between themselves
Go to Top of Page
   

- Advertisement -