如何在ADO实体数据中的两个表之间共享表属性?

时间:2022-03-11 20:13:58

i'm having a little problem in my project. i'm using ADO.Net Entity Data Model, let's say i have 2 Tables:

我的项目有点问题。我正在使用ADO.Net实体数据模型,假设我有2个表:

  1. Offices : a. id b. Name

    办公室:a。 id b。名称

  2. Requests: a. rid b.fname c.lname d.mobile

    请求:a。摆脱b.fname c.lname d.mobile

i want the requests table will have a relations to the offices table that each row in requests will have the id of the one of the tables. i tried to do 1 to many relations but it didn't work , i just couldnt add data to the table.

我希望请求表将与office表有关系,请求中的每一行都将具有其中一个表的id。我试图做一对多关系,但它没有用,我只是无法将数据添加到表中。

thanks for your guidence

谢谢你的指导

1 个解决方案

#1


0  

Your Requests table needs to have a field to relate back to the offices table. Which typically should be named OfficeID or something similar. Add that field and create the relationship from Offices.ID to Requests.OfficeID and it will work fine.

您的请求表需要有一个字段来与office表关联。通常应将其命名为OfficeID或类似名称。添加该字段并创建从Offices.ID到Requests.OfficeID的关系,它将正常工作。

#1


0  

Your Requests table needs to have a field to relate back to the offices table. Which typically should be named OfficeID or something similar. Add that field and create the relationship from Offices.ID to Requests.OfficeID and it will work fine.

您的请求表需要有一个字段来与office表关联。通常应将其命名为OfficeID或类似名称。添加该字段并创建从Offices.ID到Requests.OfficeID的关系,它将正常工作。