Base solution for your next web application

Activities of "doey28"

Hi,

Thank you for your reply.

Our code is simple, just implement sqlCoccenction like

Conn.Open();

Our existing project opens DB twice and at the second time, we have received an exception even though the first DB connection has been already closed.

Below is the exception message.

System.Transactions.TransactionAbortedException was unhandled by user code HResult=-2146233087 Message=The transaction has aborted. Source=System.Transactions StackTrace: at System.Transactions.TransactionStateAborted.CheckForFinishedTransaction(InternalTransaction tx) at System.Transactions.EnlistableStates.Promote(InternalTransaction tx) at System.Transactions.Transaction.Promote() at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction) 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.SqlClient.SqlInternalConnection.Enlist(Transaction tx) at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction) at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.Open() at *******SystemDB.Open() in *******\Utilities\DB\SystemDB.cs:line 585 at *******SystemDB.ExecuteStatement(IDbCommand cmd, StatementExecutor fn, String name, Boolean close) in *******\Utilities\DB\SystemDB.cs:line 711 at *******SystemDB.GetDataReader(IDbCommand cmd, CommandBehavior behaviour) in *******\Utilities\DB\SystemDB.cs:line 312 at *******SystemDB.GetDataReader(IDbCommand cmd) in *******\Utilities\DB\SystemDB.cs:line 291 at *******SystemDB.GetDataReader(String sprocName, Object parameters) in \Utilities\DB\SystemDB.cs:line 281 atData.DataStore.GetSchema(Int32 id) in \Individuals\Data\DataStore.cs:line 148 atIndivDbManager.<>c__DisplayClass1.<GetSchema>b__0() in *******\Individuals\IndivDbManager.cs:line 126 at *******Controllers.BaseController1.GetItem[T](GetItemFromDataStore1 getItemFromDataStore, DateTime expireAt, T_CachedItemGroup cachedItemGroup, KeyExtension[] keyExtensions) in *******\Utilities\Controllers\BaseController.cs:line 271 at *******Controllers.BaseController1.GetItem[T](GetItemFromDataStore1 getItemFromDataStore, T_CachedItemGroup cachedItemGroup, KeyExtension[] keyExtensions) in \Utilities\Controllers\BaseController.cs:line 254 atIndivDbManager.GetSchema(Int32 id) in *******\Individuals\IndivDbManager.cs:line 125 at *******GetDatabases(Int32 clientId) in *******\Database\Individuals\IndividualsDB.cs:line 72 at *******.IndividualsDbController.<>c__DisplayClass5_0.<GetDatabases>b__0() in **************\Database\Individuals\IndividualsDbController.cs:line 80 at *******Controllers.BaseController1.GetSetCachedItem[C_CachedItemType](Func1 fetch, DateTime expireAt, TimeSpan expiry, T_CachedItemGroup cachedItemGroup, KeyExtension[] keyExtensions) in *******\Utilities\Controllers\BaseController.cs:line 105 at *******Controllers.BaseController1.GetSetCachedItem[C_CachedItemType](Func1 fetch, TimeSpan expiry, T_CachedItemGroup cachedItemGroup, KeyExtension[] keyExtensions) in *******\Utilities\Controllers\BaseController.cs:line 93 at *******.IndividualsDbController.GetDatabases(IEnumerable1 clientIds) in **************\Database\Individuals\IndividualsDbController.cs:line 79 at *******.IndividualsDbController.GetDatabases(Int32 clientId) in **************\Database\Individuals\IndividualsDbController.cs:line 63 at *******.IndividualsDbController.GetDatabase(Int32 clientId, Int32 dbid) in **************\Database\Individuals\IndividualsDbController.cs:line 115 at *******.GetDataProvider() in *******.cs:line 80 at *******.GetActiveCampaigns() in *******.cs:line 99 at *******.Campaigns() in *******.cs:line 28 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.

Best regards,

Hi,

Our existing projects connect a database via a traditional way, not Entity Framework. Is it possible to access ONE database server by both Entity Framework and the way?

When connecting the DB, our existing project threw an exception that it has been already opened.

Best regards,

Showing 1 to 2 of 2 entries