c# - Handling Null Values in Controller -


i'm having issues , dont exaclty know do. have mvc project , in controller created linq query access data. i've update of data , there 0 or values. how handle in linq query? in particular d.direct has 0 values. i've tried handling in stored procedure using case when statement didnt work when page displayed

here error message:

line 2005:                { line 2006:                    try { line 2007:                        return ((double)(this[this.tablefactspendingbyindustry.empldirectcolumn])); line 2008:                    } line 2009:                    catch (global::system.invalidcastexception e) 
var rows = d in dt            select new object[] {                string.empty,//+                d.industry_code.tostring(),                 d.industry_desc,//description                                                                string.format("{0:c1}",dod/cscale),//spending millions                                                                    string.format("{0:n0}",d.direct),//direct                string.format("{0:n0}",d.indirect),//indirect                string.format("{0:n0}",d.induced),//induced                string.format("{0:c0}", math.round(wage,0)),//avg ann wage                d.nextlevelmin.tostring(),                d.nextlevelmax.tostring(),                                                                             };//end select statement             return json(new            {                                  itotalrecords = dt.count(),                aadata = rows            },  //end json return statement            jsonrequestbehavior.allowget); 

you'll have this:

d.nextlevelmin != null ? d.nextlevelmin.tostring() : string.empty 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -