0
我有以下三個表...獲取定製兒童值入電網使用LINQ
PatientEligibilities
PatientEligibilitiesServiceItems
ServiceItems
表之間的關係爲如下:
一到之間有很多:PatientEligibilities和PatientEligibilitiesServiceItems
一對一之間:PatientEligibilitiesServiceItems和ServiceItems
我檢索PatientEligibilitiesObject
我需要填寫網格PatientEligibilitiesSer viceItems
我做了以下內容:
dt = CreateDT("Code", "Description")
If PatientEligibilityObject.PatientsEligibilitiesServiceItems.Count > 0 Then
For Each LST In PatientEligibilityObject.PatientsEligibilitiesServiceItems
Dim res = HMSData.ServiceItems.Single(Function(ds) ds.ID = LST.ServiceItemID)
dt.Rows.Add(res.Code, res.EngName)
Next
Else
dt.Rows.Add("", "")
End If
uwg.DataSource = dt
這個解決方案工作正常..但我認爲這不是最好的甚至好一個..
我嘗試了以下內容:
uwg.DataSource = PatientEligibilityObject.PatientsEligibilitiesDoctorsSpecialties.GetNewBindingList()
它給了我表中的所有列..像ServiceItemID還有Servi ceItem
但我需要得到ServiceItem.Code和ServiceItem.EngName
我怎麼能這樣做?