0
문제가있어 무엇을 해야할지 잘 알고 있지 않습니다. mvc 프로젝트가 있고 내 컨트롤러에서 내 데이터에 액세스하기 위해 linq 쿼리를 만들었습니다. 그러나 일부 데이터를 업데이트했으며 0 또는 값이 있습니다. 내 linq 쿼리에서 어떻게 처리합니까? 특히 d.direct에는 0 값이 있습니다.컨트롤러에서 Null 값 처리
Line 2005: get { Line 2006: try { Line 2007: return ((double)(this[this.tableFactSpendingByIndustry.EmplDirectColumn])); Line 2008: } Line 2009: catch (global::System.InvalidCastException e)
var rows = from 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);
무엇이 문제인가? 오류가 있습니까? 예상치 못한 무언가가 표시되고 있습니까 (또는 표시되지 않습니까)? –
이것은 conosle의 오류입니다. Line 2005 : get { Line 2006 : try { Line 2007 : return ((double) (this [this.tableFactSpendingByIndustry.EmplDirectColumn]))); Line 2008 :} Line 2009 : catch (global :: System.InvalidCastException e) { –
다른 쿼리 데이터를 사용하는 데이터 테이블은 채워지지 않습니다 –