Exception on opening Connection

Exception on opening Connection

Old forum URL: forums.lhotka.net/forums/t/1397.aspx


Roger Smith posted on Thursday, October 05, 2006

Hello,

I am in the process of writing my first app using CSLA (so please bare with me).

I have no problem retreiving data from a SQL DB. However when I try to perform an update, an exception is thrown.

The code is as follows:

[Transactional(TransactionalTypes.TransactionScope)]

protected override void DataPortal_Update()

{

// if we're not dirty then don't update the database

if (!this.IsDirty) return;

using (SqlConnection cn = new SqlConnection(Database.BridgeBearingConnection))

{

cn.Open();

using (SqlCommand cm = cn.CreateCommand())

{

cm.CommandText = "updateDeliveryDateUpdate";

cm.CommandType = CommandType.StoredProcedure;

cm.Parameters.AddWithValue("@intDeliveryDateUpdateId", _intDeliveryDateUpdateId);

cm.Parameters.AddWithValue("@dteRevisedDate", _dteRevisedDate);

cm.Parameters.AddWithValue("@strRevisionReason", _strRevisionReason);

cm.ExecuteNonQuery();

}

MarkOld();

}

}

The error occurs at cn.Open(). I know my connection string is OK as I can retrieve data OK.

The error message is:

{"The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)"}

Any help greatly appreciated.

Roger Smith

Brian Criswell replied on Thursday, October 05, 2006

My first guess would be that you are running on Windows XP service pack 2 and have not enabled the distributed transaction controller.  Try a Google search for getting it up and running.

JoeFallon1 replied on Thursday, October 05, 2006

Try removing the attribute:
[Transactional(TransactionalTypes.TransactionScope)]

as a test to see if your code works correctly.

Joe

 

Roger Smith replied on Friday, October 06, 2006

Good guess Brian.

DTC was enabled on both the Client and Server. However, it was not configured correctly. I found the following link useful in resolving this:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=230390&SiteID=1

Joe: I originally had no Transaction Attribute but still got the error. Not sure why as I understand having no attribute defaults to Manual Transactions.

 

Thanks for the help!

Roger.

Copyright (c) Marimer LLC