问题
Possible Duplicate:
asp.Net TransactionScope error
whenever I put TransactionScope, I got this error.
ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.
using (TransactionScope scope = new TransactionScope())
{
ptDA.UpdateTC(InboundDS);
ptDA.Addinventor(InboundDS);
addressDA.AddAddress(InboundDS);
scope.Complete();
}
If I don't put the transaction scope , I don't get any error. This one runs well.
ptDA.UpdateTC(InboundDS);
ptDA.Addinventor(InboundDS);
addressDA.AddAddress(InboundDS);
What's wrong with my transactionScope?
回答1:
Try opening your connection within the TransactionScope.
来源:https://stackoverflow.com/questions/8305024/transactionscope-error-executenonquery-requires-an-open-and-available-connectio