简体   繁体   中英

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 .

Then also a table called tblCurrency with primary ID of currencyId .

And then had an association which was fine. Then in Linq I could use

    <%# ((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 .

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 .

But how could I make it more flexible so I can determine which currencyID from tblClaims to call?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM