我的数据看起来像这样
OtherDiag - 每个EOC 0,1或多个
var results = from dtE in ds.Tables["EOC"].AsEnumerable()
from dtPD in ds.Tables["PrinDiag"].AsEnumerable()
.Where(t => dtE.Field<string>("case_id") == t.Field<string>("case_id") )
.DefaultIfEmpty()
.GroupBy(t => t.Field<string>("case_id"))
from dtOD in ds.Tables["OtherDiag"].AsEnumerable()
.Where(t => dtE.Field<string>("case_id") == t.Field<string>("case_id"))
.DefaultIfEmpty()
.GroupBy(t => t.Field<string>("case_id")).DefaultIfEmpty()
select new { dtE, dtPD, dtOD };
我需要从这些数据创建XML。
<eocdate>
<EOC>test</EOC>
<admission>22/06/2013</admission>
<patient>
<facility_patient_id>12345</facility_patient_id>
<first_name>Matthu</first_name>
<last_name>MOmmy</last_name>
</patient>
<assessment>
<newborn_weight />
</assessment>
<principal_diagnosis>
<principal_diagnosis_code>123 </principal_diagnosis_code>
<principal_diagnosis_status>0</principal_diagnosis_status>
</principal_diagnosis>
<other_diagnosis>
<other_diagnosis_code>435 </other_diagnosis_code>
<other_diagnosis_status>0</other_diagnosis_status>
</other_diagnosis>
<other_diagnosis>
<other_diagnosis_code>345 </other_diagnosis_code>
<other_diagnosis_status>0</other_diagnosis_status>
</other_diagnosis>
<other_diagnosis>
<other_diagnosis_code>1231 </other_diagnosis_code>
<other_diagnosis_status>0</other_diagnosis_status>
</other_diagnosis>
</eocdate>
我收到“值不能为空。\ r \ nParameter name:row”
请帮忙。
谢谢,