I want to be able to bind a datagridview to information stored in my entity framework database. I only wan开发者_如何学运维t to display a subset of the information stored in my entity framework and have so far been carrying this out with a command similar to the following.
Dim x = (from store as stores
in storeentity select store.name,
store.number, store.store_manager.name)
datagridview1.datasource = x
I now want to be able to do this but be able to modify the returned rows in the datagridview and return the changes to the database. This doesnt work at the moment because I am returning an anonymous type. store.store_manager.name
is a property stored in another table linked by a FK.
Can anyone offer any guidance on how to do this and still have it track the objects. I have spent the last four hours trying to get this workng using various methods and have had no luck.
Any help is greatly appreciated, many thanks.
Have a look at ADO Entity Framework creating unwanted Entity Key and Binding Entity Framework objects to a Datagridview C# for how to modify the contents of a view in EF such that you can bind and edit. They might be helpful to you.
精彩评论