ADO.NET Entity - Help needed
i have 3 tables in my database and i created a entity model from database and it looks like this:
what im trying to do is to bind all 3 tables to datagridview and im using a query like this
var result = from t in db.Transactions
from c in db.Categories
from a in db.Accounts
where t.FkCategoryID == c.CategoryID && t.FkAccountID == a.AccountID
select new { t.Description, t.BankReference, t.TransactionDate, c.CategoryName, a.AccountName, a.AccountNr };
this works well. 开发者_JAVA技巧 But i need to be able to update the Transaction table by using the binding navigator toolbar
im not able to do that by using linq query and binding it to gridview.
Is there any way to accomplish that by using entity framework? I mean when i bind only one table to binding source im able to use that toolbar to delete update and add row but i have to show all tables and only be able to edit Transaction table
Thanks in advance
One suggestion is to create a database view for your query and map to that instead of the joined tables.
I don't think that this is possible because you are selecting annonymous type not the entity. So records in the grid are not related to your entity model. You have to handle record deletion and update by yourselves.
精彩评论