多表联合查询结果绑定到DataGrid,为什么没有数据显示!
var result = from ct in this.dmdc.ctTable join cts in this.dmdc.ctsTable on ct.id equals cts.checkTemplateId join ci in this.dmdc.ciTable on cts.checkItemId equals ci.id join it in this.dmdc.itTable on ci.typeId equals it.id select new { CheckTemplateId = ct.id, TypeId = ci.typeId, TypeName = it.typeName, ItemName = ci.itemName, StandardScore = ci.standardScore, StandardContent = ci.standardContent, Requirement = ci.requirement, } ; this.dataGrid1.ItemsSource = result;
var result = from ct in this.dmdc.ctTable join cts in this.dmdc.ctsTable on ct.id equals cts.checkTemplateId join ci in this.dmdc.ciTable on cts.checkItemId equals ci.id join it in this.dmdc.itTable on ci.typeId equals it.id select new NewClass { CheckTemplateId = ct.id, TypeId = ci.typeId, TypeName = it.typeName, ItemName = ci.itemName, StandardScore = ci.standardScore, StandardContent = ci.standardContent, Requirement = ci.requirement, } ; this.dataGrid1.ItemsSource = result.ToList();