I have the following code:
private void MigrateInTrackingChannelsDbTable(Guid toSsoId, string ctid)
{
Database database = DatabaseFactory.CreateDatabase("TrackingChannels");
try
{
using (DbCommand command = database.GetStoredProcCommand("usp_TrackingChannels_MigrateToolbar"))
{
database.AddInParameter(command, "@ToSSOId", DbType.Guid, toSsoId);
database.AddInParameter(command, "@CTID", DbType.String, ctid);
database.ExecuteNonQuery(command);
}
}
catch (Exception ex)
{
Log.Application.Error(
string.Format("CPUserService: MigrateInTrackingChannelsDbTable failed with toSsoId:{0}, ctid:{1}", toSsoId, ctid), ex);
throw;
}
}
but get the following error:
System.Transactions.TransactionException: The transaction has already been implicitly or explicitly committed or aborted. System.Runtime.InteropServices.COMException: The transaction has already been implicitly or explicitly committed or aborted (Exception from HRESULT: 0x8004D00E) ErrorCode = -2147168242 App Domain: /LM/W3SVC/819313558/Root/ToolbarBackOffice-2-129804733861185000 Level: Error Logger: application Thread Id: 1 Error Message: Migration from: efrat96811@edokleinman.com to efrat98545@edokleinman.com faild , session from: efrat96811@edokleinman.com Source:
TransactionException: The transaction has already been implicitly or explicitly committed or aborted. AT: at System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException) at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts) at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts) at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at Microsoft.Practices.EnterpriseLibrary.Data.Database.GetNewOpenConnection() in D:\Conduit\RnD\Server\Core\Dev\Microsoft.Practices.EnterpriseLibrary.Data\Database.cs:line 1168 at Microsoft.Practices.EnterpriseLibrary.Data.TransactionScopeConnections.GetConnection(Database db) in D:\Conduit\RnD\Server\Core\Dev\Microsoft.Practices.EnterpriseLibrary.Data\TransactionScopeConnections.cs:line 68 at Microsoft.Practices.EnterpriseLibrary.Data.Database.GetOpenConnection(Boolean disposeInnerConnection) in D:\Conduit\RnD\Server\Core\Dev\Microsoft.Practices.EnterpriseLibrary.Data\Database.cs:line 1194 at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command) in D:\Conduit\RnD\Server\Core\Dev\Microsoft.Practices.EnterpriseLibrary.Data\Database.cs:line 690 at CPUserInfrastructure.Services.CPUserService.MigrateInTrackingChannelsDbTable(Guid toSsoId, String ctid) in D:\Conduit\RnD\Server\Services\CPInfrastructure\CPUserInfrastructure\CPUserInfrastructure\Services\CPUserService.cs:line 772 at CPUserInfrastructure.Services.CPUserService.<>c_DisplayClass8.b_7() in D:\Conduit\RnD\Server\Services\CPInfrastructure\CPUserInfrastructure\CPUserInfrastructure\Services\CPUserService.cs:line 386 at CPInfrastructure.Helpers.TransactionHelpers.RunInTransaction(Action logic) in D:\Conduit\RnD\Server\Services\CPInfrastructure\CPInfrastructure-Dev\Helpers\TransactionHelpers.cs:line 17 at CPUserInfrastructure.Services.CPUserService.MigrateCPuserToolbar(Guid toSsoId, String ctid) in D:\Conduit\RnD\Server\Services\CPInfrastructure\CPUserInfrastructure\CPUserInfrastructure\Services\CPUserService.cs:line 390 at BrandToolbar.Admin.ToolbarBackOffice.Toolbar.AccountsManagement.btnMTMigrate_Click(Object sender, EventArgs e) in D:\Conduit\RnD\Server\WebSites\Writers\Dev-Accounts-4.0\AdminServices\Admin.Toolbar\Integration\BrandToolbar.Admin.ToolbarBackOffice\Toolbar\AccountsManagement.aspx.cs:line 142
COMException: The transaction has already been implicitly or explicitly committed or aborted (Exception from HRESULT: 0x8004D00E) AT: at System.Transactions.Oletx.ITransactionShim.Export(UInt32 whereaboutsSize, Byte[] whereabouts, Int32& cookieIndex, UInt32& cookieSize, CoTaskMemHandle& cookieBuffer) at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
User contributions licensed under CC BY-SA 3.0