< class="prominent-subhead ">

Code Fix: Executing a SQL Stored Procedure SmartObject from a linked SQL Server results in an error

~~repeating-content.html~~
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

Issue Description

After upgrading to K2 4.7, executing a SQL Stored Procedure SmartObject from a linked SQL Server, results in an error.

Error Message

“This SqlTransaction has completed; it is no longer usable”.

Cause

Linked SQL queries do not support nested transactions in the same way that DAC implements transactions.

Resolution

  1. Ensure you have K2 4.7 installed.
  2. Download and install the K2 4.7 May 2017 Cumulative Update from K2 Partner and Customer Portal
  3. Get the K2 4.7 May 2017 Cumulative Update FP1 from Regional Support.
  4. Install the K2 4.7 May 2017 Cumulative Update FP1 to apply the fix.

Considerations

  • This issue is concerned with transactions (Rollback\Commits).
  • If you build a new SmartObject, you can specify in the method if it must Continue, Stop or Rollback when an error occurs.
  • If you perform an insert with a stored procedure, and an error occurs afterward, you will expect the following behavior given the transaction type:
Continue: The row will be inserted and will move to the next instruction
Stop: The row will be inserted and the rest of the instructions will be aborted
Rollback: The row should not be inserted