c# - Specified Cast not Valid error using Nhibernate -


using nhibernate, visual studio 2010, c#.

i having problem converting decimal? type. code gives

specified cast not valid error

and fails on .uniqueresult<> line.

following code.

private decimal? getcostvaluefromquery(string query, itempricecontext item) {     var session = activerecordmediator.getsessionfactoryholder()                                       .createsession(typeof(object));     return session.createsqlquery(string.format(query, item.itemcode))                   .uniqueresult<decimal?>(); } 

the result of sql query 62.3891005516052

i suspect result has lot of decimal places , hence fails.

any suggestions how round result or reduce result such supported?

use whatever rounding, truncating etc. need in select-part of sql query.

but should check actual return type of sql query is. decimal?


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -