Error with promotions v2.5

Posted By TheCalicoTree Thu 28 Nov 2013
Add to Favorites0
Author Message
TheCalicoTree
 Posted Thu 28 Nov 2013
Supreme Being

Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)

Group: Forum Members
Last Active: Thu 18 Jun 2015
Posts: 98, Visits: 1,382
We recently upgraded to 2.5 to get around some earlier errors (particularly with promotions). Now, when a customer tries to buy a promotional offer it gets to the checkout Proceed button and then errors...
[code]

----------------------------------------------------------------------------

>> OrdersBLL.Add

-----------------------------------------------------------------------------

>> System.Data.SqlClient.SqlException

>> 24/11/201318:28:14

>> Version:2.5005

>> URL:http://www.hotel-buyer-store.co.uk/Checkout.aspx

>> 109.204.115.163

>> CUSTOMMESSAGE:

Database Error: duplicate-key violation.

>> NUMBER:2627

>> MESSAGE:

Violation of PRIMARY KEY constraint'PK_tblKartrisOrdersPromotions'. Cannot insert duplicate key in object'dbo.tblKartrisOrdersPromotions'.

The statement has been terminated.

>> STACK:

atSystem.Data.SqlClient.SqlConnection.OnError(SqlException exception, BooleanbreakConnection)

atSystem.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection)

atSystem.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

atSystem.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)

atSystem.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior, String resetOptionsString)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)

atSystem.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResultresult)

atSystem.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result,String methodName, Boolean sendToPipe)

atSystem.Data.SqlClient.SqlCommand.ExecuteNonQuery()

atOrdersBLL.Add(Int32 C_ID, String strUserEmailAddress, String strUserPassword,Address BillingAddress, Address ShippingAddress, BooleanblnSameShippingAsBilling, BasketBLL BasketObject, ArrayList BasketArray, StringstrOrderDetails, String strGatewayName, Int32 intLanguageID, Int32intCurrencyID, Int32 intGatewayCurrencyID, Boolean blnOrderEmails, StringstrShippingMethod, Double numGatewayTotalPrice, String strEUVATNumber, StringstrPromotionDescription, String strPurchaseOrderNo, String strComments)

==================================================

[/code]

Having looked at tblKartrisOrdersPromotions I can see that there is no data so I do not understand how it can be erroring on a duplicate key.
Paul
 Posted Thu 28 Nov 2013
große Käse

große Käse - (449,542 reputation)große Käse - (449,542 reputation)große Käse - (449,542 reputation)große Käse - (449,542 reputation)große Käse - (449,542 reputation)große Käse - (449,542 reputation)große Käse - (449,542 reputation)große Käse - (449,542 reputation)große Käse - (449,542 reputation)

Group: Administrators
Last Active: Fri 15 Sep 2023
Posts: 806, Visits: 2,737
Curious... I tested a 2.5008 locally and it works ok, so I can only think is related to something not upgrading right.

The tblKartrisOrdersPromotions table has two columns, one for the promotion ID, another for the order ID. The combination of these is enforced as a unique key.

The only way I can think a duplicate key issue would happen is if for some reason, it is inserting the same thing twice... that might trigger the error and then a rollback of the transaction, so nothing remains in the db (transactions are bundled operations that either succeed or fail as a whole - if there is a failure in some part, the whole thing is rolled back). But I am not exactly sure how that can happen as I can't reproduce the same thing).


--
If my post solves your issue, can you 'Mark as Answer' so it's easier for other users to find in future.

If you would like to be informed of new features, new releases, developments and occasional special bonuses, please sign up to our mailing list: http://bit.ly/19sKMZb
TheCalicoTree
 Posted Thu 28 Nov 2013
Supreme Being

Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)Supreme Being - (62,944 reputation)

Group: Forum Members
Last Active: Thu 18 Jun 2015
Posts: 98, Visits: 1,382
Thanks Paul - we're 2.5005 not 8 so I'm not sure if you can test with that?

The error occurred 10 times in rapid succession during that one transaction. Worryingly it also incremented the order numbers by 10 although no orders were actually created.

We used the data tool to upgrade our database as I was unable to get the upgrade scripts running.

tblKartrisOrdersPromotions is empty so I cannot see how a duplicate key error would occur unless it was trying to write a null record? But then that would fail on NULL values I think.

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top