473,395 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with transactions

Hi,

I have an application that uses a web service to access a
SQLServer database. Theses 3 elements are on seperate
machines.

Part of my webservice looks like this:

[WebMethod(TransactionOption =
TransactionOption.RequiresNew, Description="Specific
Method to Query Table1, Table2 and Table3 from the
database")]
public void SaveTables(DataSetApplication dsApp,
ConnectionMode mode)
{
using (SqlConnection sqlConnection = new SqlConnection
(GetConnectionString(mode)))
{
sqlConnection.Open();
InitializeConnection(sqlConnection);

sqlDataAdapterTable1.Update(dsApp);
sqlDataAdapterTable2.Update(dsApp);
sqlDataAdapterTable3.Update(dsApp);

sqlDataAdapterTable1.Dispose();
sqlDataAdapterTable2.Dispose();
sqlDataAdapterTable3.Dispose();
sqlConnection.Close();
}
}
Then I get the following error:

Exception: System.Web.Services.Protocols.SoapException
Message: Server was unable to process request. -->
MSDTC on server 'SQL03' is unavailable.
My question is, how can I modify the code so that the
transaction is in the code and not used directly on the
DB. (The DBA wont change anything on his side...)

Nov 22 '05 #1
4 1306
Hi,

You might explicitely start a transaction by:
SqlTransaction trans = sqlConnection.BeginTransaction;
try
{
...
trans.Commit;
}
catch (Exception ex)
{
trans.Rollback;
...
}
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"WhiteEagl" <wh*******@hotmail.com.REMOVE> wrote in message
news:02****************************@phx.gbl...
Hi,

I have an application that uses a web service to access a
SQLServer database. Theses 3 elements are on seperate
machines.

Part of my webservice looks like this:

[WebMethod(TransactionOption =
TransactionOption.RequiresNew, Description="Specific
Method to Query Table1, Table2 and Table3 from the
database")]
public void SaveTables(DataSetApplication dsApp,
ConnectionMode mode)
{
using (SqlConnection sqlConnection = new SqlConnection
(GetConnectionString(mode)))
{
sqlConnection.Open();
InitializeConnection(sqlConnection);

sqlDataAdapterTable1.Update(dsApp);
sqlDataAdapterTable2.Update(dsApp);
sqlDataAdapterTable3.Update(dsApp);

sqlDataAdapterTable1.Dispose();
sqlDataAdapterTable2.Dispose();
sqlDataAdapterTable3.Dispose();
sqlConnection.Close();
}
}
Then I get the following error:

Exception: System.Web.Services.Protocols.SoapException
Message: Server was unable to process request. --&gt;
MSDTC on server 'SQL03' is unavailable.
My question is, how can I modify the code so that the
transaction is in the code and not used directly on the
DB. (The DBA wont change anything on his side...)

Nov 22 '05 #2
If you need distributed transaction support you need to have MSDTC running,
you can't handle this in code yourself.
Why has the DBA decided to stop the DTC, does he really know what it's used
for?

Willy.

"WhiteEagl" <wh*******@hotmail.com.REMOVE> wrote in message
news:02****************************@phx.gbl...
Hi,

I have an application that uses a web service to access a
SQLServer database. Theses 3 elements are on seperate
machines.

Part of my webservice looks like this:

[WebMethod(TransactionOption =
TransactionOption.RequiresNew, Description="Specific
Method to Query Table1, Table2 and Table3 from the
database")]
public void SaveTables(DataSetApplication dsApp,
ConnectionMode mode)
{
using (SqlConnection sqlConnection = new SqlConnection
(GetConnectionString(mode)))
{
sqlConnection.Open();
InitializeConnection(sqlConnection);

sqlDataAdapterTable1.Update(dsApp);
sqlDataAdapterTable2.Update(dsApp);
sqlDataAdapterTable3.Update(dsApp);

sqlDataAdapterTable1.Dispose();
sqlDataAdapterTable2.Dispose();
sqlDataAdapterTable3.Dispose();
sqlConnection.Close();
}
}
Then I get the following error:

Exception: System.Web.Services.Protocols.SoapException
Message: Server was unable to process request. --&gt;
MSDTC on server 'SQL03' is unavailable.
My question is, how can I modify the code so that the
transaction is in the code and not used directly on the
DB. (The DBA wont change anything on his side...)

Nov 22 '05 #3
He knows what it is but I dont know why he wont activate
it...

Can Miha Markic's answer be a way to solve this problem?
You say that it can't be done in code...

Thanks

-----Original Message-----
If you need distributed transaction support you need to have MSDTC running,you can't handle this in code yourself.
Why has the DBA decided to stop the DTC, does he really know what it's usedfor?

Willy.

"WhiteEagl" <wh*******@hotmail.com.REMOVE> wrote in messagenews:02****************************@phx.gbl...
Hi,

I have an application that uses a web service to access a SQLServer database. Theses 3 elements are on seperate
machines.

Part of my webservice looks like this:

[WebMethod(TransactionOption =
TransactionOption.RequiresNew, Description="Specific
Method to Query Table1, Table2 and Table3 from the
database")]
public void SaveTables(DataSetApplication dsApp,
ConnectionMode mode)
{
using (SqlConnection sqlConnection = new SqlConnection (GetConnectionString(mode)))
{
sqlConnection.Open();
InitializeConnection (sqlConnection);
sqlDataAdapterTable1.Update(dsApp);
sqlDataAdapterTable2.Update(dsApp);
sqlDataAdapterTable3.Update(dsApp);

sqlDataAdapterTable1.Dispose();
sqlDataAdapterTable2.Dispose();
sqlDataAdapterTable3.Dispose();
sqlConnection.Close();
}
}
Then I get the following error:

Exception: System.Web.Services.Protocols.SoapException
Message: Server was unable to process request. -->
MSDTC on server 'SQL03' is unavailable.
My question is, how can I modify the code so that the
transaction is in the code and not used directly on the
DB. (The DBA wont change anything on his side...)

.

Nov 22 '05 #4
Hi,
"WhiteEagl" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
He knows what it is but I dont know why he wont activate
it...

Can Miha Markic's answer be a way to solve this problem?
You say that it can't be done in code...


Willy is talking about *distributed* transactions and he is right - you need
DTC and can't be done through code (ok, well, probably it could in a way or
another :) ).
While I was talking about normal (one database) transactions.
Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Vanchau Nguyen | last post by:
Hi all, Hoping someone can help us with this strange Innodb problem. At about 5:15 AM 2/2/04 (this morning), our slave server stopped accepting connections. The machine was pingable, but you...
6
by: Hennie de Nooijer | last post by:
Hi, Currently we're a building a metadatadriven datawarehouse in SQL Server 2000. We're investigating the possibility of the updating tables with enormeous number of updates and insert and the...
7
by: Richard Maher | last post by:
Hi, I am seeking the help of volunteers to test some software that I've developed which facilitates distributed two-phase commit transactions, encompassing any resource manager (e.g. SQL/Server...
11
by: Mike P | last post by:
I've been using C# transactions for a while and had no problems with them. Using try catch blocks I can trap basically all possible errors and rollback all necessary data. Over the last few...
8
by: Don Riesbeck Jr. | last post by:
I have an C# EnterpriseService component that is part of an application I am developing that is responsible for writing data to an SQL Server. (it reads from a local DB (MSDE), then writes to a...
0
radcaesar
by: radcaesar | last post by:
Customer Table ID Name Address City Phone 1 Vijay Stores 6,Gandhi Road Pondy 0413-276564 2 Ram Stores 3, MG Road, Pondicherry 0413-29543756 3 Balu Papers 3, RG...
0
radcaesar
by: radcaesar | last post by:
Hi All, I Have Three Tables, Customer NewTransaction Transactions The Customer Table Have details about customer and the Transactions table had details of the transactions with gross...
4
by: Ron | last post by:
Hi All, I've got a client/transaction type of database where tblClient is linked to tblTransactions via ClientID. The client table contains all clients from day one. The transaction table...
1
by: Jan | last post by:
Hi: I've been tearing my hair out over this one for a few days; did a search of the archives and found similar questions but no real answers. Here goes: This is an application for a retail...
1
kiemxai
by: kiemxai | last post by:
you see that,i did correct or not? PROBLEM ANALYSIS For an introduction to program transaction journal, see the background section of assignment . Not only transaction journal, but also inventory...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.