Cannot convert DBNull to value

  • 18 November 2016
  • 2 replies

Badge +10



The issue occurs in K2 4.7 when executing a SmartObject created from a SQL Stored Procedure with the SQL Server Service Broker. If one of the return properties contains a ?NULL? in a ?Number? field, a ?Object cannot be cast from DBNull to other types? error is displayed. This did not happen in K2 4.6.11 and the SmartObject worked correctly.


Executing the Stored Procedure in SQL shows a ?NULL? as a return value in one of the fields.
Executing the SmartObject in K2 4.7 using the Tester Tool gives the error. Executing the same SmartObject in K2 4.6.11 using the Tester Tool works as expected.


The issue appears to happen only in K2 4.7 when a SmartObject based off a SQL Stored Procedure returns a NULL as a return value.

A new bug item has been logged for our developers to investigate and address in a future update of K2.

The current workaround is to set the return variable to a valid number during the execution of the Stored Procedure so that a valid number is returned during the SmartObject execution.


2 replies

Badge +2

Is there a fix for this as we have the same issue, after tghe update to 4.7 from older version e get te same error

Any news ?

We've the same issue after an upgrade from K2 4.6.9.