Knowledge Base
smartDBforms.NET for ASP.NET 2
 
 
Knowledge Base Forum
Search knowledge base:

FIX: Disallowed implicit conversion from data type nvarchar to data type money. Use the CONVERT function to run this query.
Wednesday, 11 July 2007

SYMPTOMS

When using Sql Server database and the SmartDataSource Select command contains parameters which are implicitly cast to money type the following error appears when trying to extract the data:

"Disallowed implicit conversion from data type nvarchar to data type money. Use the CONVERT function to run this query."

Setting the parameter's type to Decimal solves the problem in runtime but the problem remains at design time.

CAUSE

In design time SmartDataSource ignores the specified parameter type and always sets the command parameters' type to be the default one - DbType.String.

RESOLUTION

The problem has been fixed in smartDBforms.NET 1.5 and later.  The select parameters' type is properly propagated to the select command in design time. Setting the parameter's type to Decimal fixes the problem in design time and runtime.

WORKAROUND

In order to fix the problem in design time, use the CONVERT function in the select statement to explicitly convert the database parameter to money.

APPLIES TO

smartDBforms.NET 1.4 and previous versions when used with MS Sql Server database.


Page Options: format for printing  Format for Printer

How would you rate the quality of this content?
Poor - - Excellent
Comments? 
Overall Rating: No ratings available.
Comments Left:
Left on Tuesday, 11 December 2007 by Anonymous
Comments:
No ratings available.
Copyright 2006-2008 Adillis Terms Of Use Feedback Contact Us