All I am doing is calling the method SaveAsPurchaseOrder then accept changes, i decompiled the code and copy paste it so i can step into it, and i found the exception is thrown on the line:
in my cart i have two line items with different skus, and no payment info, nor address info.
the exception message:
The transaction associated with the current connection has completed but has not been disposed.
The transaction must be disposed before the connection can be used to execute SQL statements.
some says it is a timeout issue, so i configured my machine.config file to increase the maxtimeout
I am not sure what I should do to make it working.
Which is the code you are using?
nothing special about my code:
var cart = OrderContext.Current.GetCart(request.CartName, userId);
cart.SaveAsPurchaseOrder(); // error occurs here
I don't think you have to call cart.AcceptChanges() here. When you call SaveAsPurchaseOrder(), you're creating an purchase order and saving it. the cart now can be discarded.
The code should be
var order = cart.SaveAsPurchaseOrder();
//work with order from here.
thanks for pointing this out. but my error is occurring when i call
do i have set\configure anything in the cart before i can convert it to an order? please exacue my simple qustions, i am new to episerver commerce.
Can you post the exact stack trace? The code looks correct though ...
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at Mediachase.Data.Provider.TransactionScope.Dispose(Boolean disposing)
at Mediachase.Data.Provider.TransactionScope.Dispose() at Mediachase.Commerce.Orders.Cart.SaveAsPurchaseOrder()
at MyProjectMarketing.Business.ServiceBus.OrdersSystemProcessor.CheckoutCompleteOrder(CheckoutCompleteOrderRequest request)
It looks like the issue is in your database itself, instead of the code.
I would suggest to check the database performance, it looks like the hardware it's running on is being slow (out of memory, out of hard disk, fragment hard disk ...).
Ok, I will take a look at that. I appreciate your help Quan.