[英]ASP.NET Linq to sql multiple foreign keys to primary key different table
I have a table called claims
which has an id called currencyId
of datatype INT
. 我有一个名为
claims
的表,该表具有一个名为currencyId
的数据类型INT
的ID。
Then also a table called tblCurrency
with primary ID of currencyId
. 然后还有一个名为
tblCurrency
的表,其主ID为currencyId
。
And then had an association which was fine. 然后有一个很好的关联。 Then in Linq I could use
然后我可以在Linq中使用
<%# ((claim)Container.DataItem).currency.value %>
But now I have to add another INT
column to tblClaims
called finalCurrencyID
which I also want an association with to tblCurrency
. 但是现在我必须向
tblClaims
添加另一个INT
列,称为finalCurrencyID
,我也希望与tblCurrency
关联。
Just wondering how I could achieve this, so at the moment ((claim)Container.DataItem).currency.value
is linking up claim.currencyId
to tblCurrency.currencyID
and getting tblCurrency.value
. 只是想知道我怎么能做到这一点,所以在此刻
((claim)Container.DataItem).currency.value
的衔接claim.currencyId
到tblCurrency.currencyID
并获得tblCurrency.value
。
But how could I make it more flexible so I can determine which currencyID
from tblClaims
to call? 但是如何使它更加灵活,以便可以确定要从
tblClaims
调用哪个currencyID
?
If I read the right, I think you are looking for this: 如果我没看错,我认为您正在寻找:
<%# ((claim)Container.DataItem).finalCurrency.value %>
Assuming, of course, that you've wired up claim
to have a L2S FK to finalCurrency
. 当然,假设您已经
claim
将L2S FK连接到finalCurrency
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.