使用 LINQ 添加子值始终为 1

发布于 2024-11-25 03:59:15 字数 1078 浏览 4 评论 0原文

我有表

PatientEligilit患者资格医生专业医生专科

患者资格 具有外键 PatientsEligibilitiesDoctorsSpecialtyID 来自 患者资格医生专业

PatientsEligbilitiesDoctorsSpecialty 具有外键 DoctorsSpecialtyID 来自 医生专业

然后使用VB.NET LINQ:我正在尝试添加子项目(PatientsEligibilitiesDoctorsSpecialty) 给它的父级(PatientEligilit

,然后我提交更改,

例如:

PatientEligibilityObject.PatientsEligibilitiesDoctorsSpecialties.Add(New PatientsEligibilitiesDoctorsSpecialty With {.DoctorSpecialtyID = si.ID, .RegDate = Date.Now})                                                                            PatientEligibilityObject.PatientsEligibilitiesDoctorsSpecialties.Add(PEDS)
HMSData.SubmitChanges()

它运行良好,并以正确的日期将记录保存在数据库中

DoctorSpecialtyID 

始终保存为值1

I have the Tables

PatientEligibilit
and
PatientsEligibilitiesDoctorsSpecialties
and
DoctorsSpecialties

PatientEligibilit
has foreign key PatientsEligibilitiesDoctorsSpecialtyID from
PatientsEligibilitiesDoctorsSpecialties
table

and

PatientsEligibilitiesDoctorsSpecialty
has foreign key DoctorsSpecialtyID from
DoctorsSpecialties
table

THEN USING VB.NET LINQ: i'm tring to add child item ( PatientsEligibilitiesDoctorsSpecialty)
to it's parent (PatientEligibilit)

then I submit Changes

like :

PatientEligibilityObject.PatientsEligibilitiesDoctorsSpecialties.Add(New PatientsEligibilitiesDoctorsSpecialty With {.DoctorSpecialtyID = si.ID, .RegDate = Date.Now})                                                                            PatientEligibilityObject.PatientsEligibilitiesDoctorsSpecialties.Add(PEDS)
HMSData.SubmitChanges()

it's worked fine and save record in Database with correct date

BUT

DoctorSpecialtyID 

always saved with value 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花心好男孩 2024-12-02 03:59:15

我解决它。问题出在表之间的关系上。

PatientEligibilityPatientsEligbilitiesDoctorsSpecialties 之间的外键
不正确..

I solve it. the problem was in the relation between the tables.

The foreign key between PatientEligibilit and PatientsEligibilitiesDoctorsSpecialties
was not correct..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文