Hello,
I developed a WebMethod that uses a transaction:
C # code:
Code:
using (TransactionScope scope = new TransactionScope ())
(
SqlConnection connection = null;
SqlCommand command = null;
[..] / / Treatment
try
(
/ / Calling a stored procedure using a transaction
command. ExecuteNonQuery ();
)
catch (Exception ex)
(
log. Error (eg Message);
throw new Exception ( "Error in the backup database.", ex);
)
trs. Complete ();
[..] / / Treatment
)
As you can see this WebMethod uses a stored procedure that uses a transaction. This stored procedure developed in a database in SQL Server 2005 is outlined below:
Sql code:
Code:
CREATE PROCEDURE [dbo]. [MyProcedure]
(
- List of parameters
)
AS
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
BEGIN TRANSACTION MyTransaction
- Treatment
COMMIT TRANSACTION MyTransaction
Sometimes the exception with the following message is launched by the database:
Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.
What do I do to fix this problem?
Thank you in advance,
Bookmarks